A better way to redirect link with a .php file.
Thanks to Alvin, he pointed out that it is better to have HTTP 301 redirection. I had edited se1.php to se2.php so that HTTP header will contain a HTTP 301 redirection instead of a HTTP 302.
What is the fuss about 301 Permanent and 302 Temporary redirect? It all has to do with GOOGLE. Somehow Google likes 301 better and while it may downgrade your page’s PR if a 302 is used.
Now here is how to do it. (se2.php)
< ?php
header("HTTP/1.1 301");
header ("Location: http://www.google.com");
exit;
?>
Yeah, it is simple. Just one more line - header(”HTTP/1.1 301″);
Without this line, the default 302 will be used instead.
Please check http://www.aukcweb.com/2006/09/29/how-to-redirect-to-other-link/ for more details.
You can try it http://www.aukcweb.com/goto/se2.php
You would not notice any difference just by viewing with your browser, but it will actually issue a 301 redirect which is Google spider friendly. I used an HTTP header capture software to catch the headers which I had included below.
[From Req: GET http://www.aukcweb.com/goto/se2.php HTTP/1.1]
HTTP/1.1 301
Date: Mon, 02 Oct 2006 08:30:06 GMT
Server: Apache
Location: http://www.google.com
Transfer-Encoding: chunked
Content-Type: text/html
Connection: Close
Compare this to headers generated by se1.php
[From Req: GET http://www.aukcweb.com/goto/se1.php HTTP/1.1]
HTTP/1.1 302
Date: Mon, 02 Oct 2006 08:24:17 GMT
Server: Apache
Location: http://www.google.com
Transfer-Encoding: chunked
Content-Type: text/html
Connection: Close
Posted: October 2nd, 2006 under Internet.
Comments: none
Write a comment