Skip to content
Advertisement

How to redirect php file outside of the folder location?

Hello how do you redirect a page outside of the ‘Model’ folder because all my html files are outside of it. I want to redirect my page using this location

http://localhost/laurence/FirstDayTraining/index.html

Example: I have a php folder inside the ‘Model’ folder name login.php so in order to redirect it to the index.html, I have to use header("Location: laurence/firstdaytraining/index.html"); but when I click enter this will be displayed

Object not found!

The requested URL was not found on this server. The link on the referring page seems to be wrong or outdated. Please inform the author of that page about the error.

If you think this is a server error, please contact the webmaster.

Error 404

and the location is going to this path

http://localhost/laurence/FirstDayTraining/Model/index.html

Please help, how to redirect my page in this

http://localhost/laurence/FirstDayTraining/index.html

but not this

http://localhost/laurence/FirstDayTraining/Model/index.html

Advertisement

Answer

<?php
    header('Location: ../index.html');
    exit;
?>
User contributions licensed under: CC BY-SA
1 People found this is helpful
Advertisement