I am new to php and I faced this problem while redirecting to other php files. To make my question clear I created two php files. first.php and second.php.Both this files are found in /var/www/test/. This is the code in first.php
<?php
$url = "localhost/test/second.php";
header("Location:$url"); ?>
This is the code in second.php
<?php
echo("this is the second page"); ?>
And when I browse to first.php file I got this in my Firefox browser.
The requested URL /test/localhost/test/second.php was not found on this server.
test/ is added to the header string, which is clear as you can see. Thank you.