How to do 301 (Permanent Redirection) in PHP
It is really simple.
Just put the following 2 lines at the top of the page you are trying to redirect.
header(“HTTP/1.1 301 Moved Permanently”);
header (‘location: <<your landing page>>”);
Replace <<your landing page>> with the URL of the landing page.
Remember, you need these 2 lines before any output statement is made on your script, else you will get a ‘headers already sent’ error.
| Print article | This entry was posted by iamzen on September 5, 2009 at 12:17 pm, and is filed under tutorial. Follow any responses to this post through RSS 2.0. You can leave a response or trackback from your own site. |
about 1 year ago
The 301 Redirection is usually carried out in the root directory of the web server. Url Shortening Service