PHP header redirect

PHP header redirect Redirect users to another page or site using header: Location At times, you may find yourself moving pages around or even changing domain names. Using the header function of PHP we can direct visitors (and search engines for that matter) to the new location with 3 lines of code. <?php header ('HTTP/1.1 301 Moved Permanently'); header ('Location: http://www.example.com/newpage.php'); exit; ?> You can redirect visitors to a page or another domain/sub-domain. It is very important that you include the exit portion at the end of the code. This prevents PHP from processing any further. References: PHP header function - http://us.php.net/header
No votes yet

Post new comment

The content of this field is kept private and will not be shown publicly.
  • Lines and paragraphs break automatically.
  • Allowed HTML tags: <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd>

More information about formatting options

Captcha
Enter the text exactly as it appears to continue
Copy the characters (respecting upper/lower case) from the image.