5/20/2013

PHP header Redirect for 301 Redirect permanently vs 302 Redirect Temporarily

1. PHP Redirect Code (permanent redirects)

Code 1. 
<?php
header("HTTP/1.1 301 Moved Permanently");
header("Location: http://www.researchbib.com");
?>

2. it is not same with (temporarily redirects)

Code 2.
<?php
header("Location: http://www.researchbib.com"); 
?>

====
<?php
header("HTTP/1.1 302 Moved Temporarily");
header("Location: http://www.researchbib.com");
?>

Please be careful.

If you set A page with code 1 or code 2, it is different for google index result.

Code 1: Google will index http://www.researchbib.com and url is http://www.researchbib.com, which means google will throw away A url. The google will dispaly www.researchbib.com link when usr search this page.

Code 2: Goodle will inex the contents from http://www.researchbib.com and url is A. The google will dispaly A link when usr search this page.



2014 1st International Conference on Non Conventional Energy


No comments:

Post a Comment