I have a first.php page with
first.php
header("Location: script/script1.php")
and script1.php has another
script1.php
header("Location: first.php")
but it explicitly passes me /script/first.php . Is there a way to redirect it to <root>/first.php instead of <root>/script/first.php ?
/script/first.php
<root>/first.php
<root>/script/first.php
try with this:
header("Location: ../first.php")
or use an absolute path or url.
Explanation: .. is the unix / linux expression used for the "parent directory". The Internet is unix-land, so the rules apply.
..
Instead: header("Location: ../first.php")
try: header("url: ../first.php")
header("url: ../first.php")
this will change url.Using does not work in some cases
Since: '../' means "parent directory". This way it will work.
'../'
Can you do this. Redirects back to the home directory (Root) in "0" seconds -
<?php header('Refresh: 0, url = /Root_Dir/'); ?>
Replace "Root_Dir" with the name of your directory.