Developer Snippet Diary

PHP redirect to another page using script tag

In PHP, you can redirect users to a new URL by using a JavaScript code that changes the window location. This can be useful if you need to move content to a new location, or if you want to redirect users to a different page based on their actions. In this tutorial, we will show you how to create a PHP script that redirects users to a new URL using a JavaScript code.

<?php
$script = "<script> window.location = '$newurl';</script>";
echo $script;
die;
Posted by: R GONDAL
Email: rizikmw@gmail.com