PHP How to header-location to a page in a parent directory?

Instead of: header("Location: ../first.php")

try with this: header("url: ../first.php")

this will change the url.Using location don't work in some cases

Since: '../' is to denote 'parent directory'.So,this will work.


have a try with this:

header("Location: ../first.php")

or use an absolute path or url instead.

Explanation: .. is the unix/linux expression used for 'parent directory'. The Internet is unix land, so that rules applies there too.


You can do this. Redirects back to the Home directory (Root) in '0' seconds -

<?php

     header('Refresh: 0, url = /Root_Dir/');

?>

Replace the 'Root_Dir' with your directory name.