question about page redirection or reload

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
greedyisg00d
Forum Commoner
Posts: 42
Joined: Thu Feb 12, 2009 2:48 am

question about page redirection or reload

Post by greedyisg00d »

Hi I am just a bit confused of what us the best way to reload or redirect a page in php. Usually I used header function for example

Code: Select all

header('location:schedulelist.php');
My next question is it needed to include the full url of the page for example http://localhost/schedulelist/login.php or I can just use the page url only which is schedulelist.php.

The reason why I am asking is that I am currently testing through localhost and since the domain name will be change upon deployment, I do not want my visitors to encounter broken links in navigating my page.

Thanks
User avatar
Benjamin
Site Administrator
Posts: 6935
Joined: Sun May 19, 2002 10:24 pm

Re: question about page redirection or reload

Post by Benjamin »

Yes, you do need to use the complete URL. You can however define it in a constant, so that it only needs to be changed in one place for production.
Post Reply