301 and 302 Redirects


301 and 302 redirects are quite an important topic in the SEO (Search Engine Optimization). 301 creates the redirect telling the search engines that the link has moved to a new place, permanently. On the other hand, the 302 tells the search engine it is only moved just temporarily. It affects the page rank of the sites. For example, the google search engine will probably divide the scores between the new and old URL if it is 302 temporary. The 301 will tell the search engines to update the URL in their database. Some search engines may treat 302 as spams.

Creating a 301 redirect in PHP is rather simple. Put an index.php under the URL folder and the file has the following few lines.

1
2
3
4
<?php
  Header( "HTTP/1.1 301 Moved Permanently" );
  Header( "Location: https://helloacm.com" );
?>
<?php
  Header( "HTTP/1.1 301 Moved Permanently" );
  Header( "Location: https://helloacm.com" );
?>

The 301 redirects will transfer the SEO score to the new URL. The 302 tells search engines that the SEO score stays with the previous URL, although visit the new URL.

Some search engines are clever enough to get the data from WHOIS, they will check if the redirected URLs belong to the same organisation (domain registration). If it is not, the URL redirections will be punished badly and the site will be given the lowest SEO score.

–EOF (The Ultimate Computing & Technology Blog) —

GD Star Rating
loading...
255 words
Last Post: Jagged arrays and Multidimensional array in C#
Next Post: Bash SHELL, Chess Board Printing

The Permanent URL is: 301 and 302 Redirects

Leave a Reply