301 Redirect

Difference between 301 Permanent and 302 Temporary Redirect

February 12th, 2010

Permanent 301
They are permanent redirects from an old URL to a new one. These redirects tell the search engines that the old location is to be removed from their index and replaced with the new location. Using 301 redirects is the most search engine friendly way to redirect traffic and engines, and far out weighs that of various JavaScript and Meta refresh redirects.

A 301 permanent redirect will notify the visitor’s browser to update any bookmarks that are linked to the page that is being redirected.

Temporary 302
Here you are telling the search engines to read and use the content on the new page, but to keep checking the original URL first as it will ultimately be reestablished.

A 302 Temporary redirects will not update the visitor’s bookmark.

How to Redirect a folder to a Subdomain using .htaccess

January 7th, 2010

If you create a sub domain (e.g. shop.example.com) from cPanel you will find that a subfolder (example.com/shop) in the same name has been added to the directory list. When you upload anything on the folder, it will reflect in the subdomain created. When you visit shop.example.com or example.com/shop, you will see that the content is the same.

There is nothing wrong with it, however from the view point of SEO and Search engines, this creates duplicate content, because… for search engines a folder is different from a subdomain. To avoid this issue we can simply add or edit the .htaccess. This will tell SE’s that the folder has been permanently redirected to the sub domain.

RewriteEngine on 
RewriteCond %{HTTP_HOST} !^folder.example.com
RewriteRule (.*) http://subdomain.example.com/$1 [L,R=301] 

Please change (subdomain, example) as per your website.

Creating 301 Permanent Redirect

August 16th, 2009

301 redirect is the most efficient and Search Engine Friendly method for webpage redirection. It’s not that hard to implement and it should preserve your search engine rankings for that particular page (including Google PR). If you have to change file names or move pages around, it’s the safest option. The code “301” is interpreted as “moved permanently”.

1. Login to cPanel and click the Redirects icon.
2. Leave the setting as 301 redirect, as this is preferred by search engines.
3. Select the appropriate domain name from the drop-down.
4. In the subsequent blank, enter an optional path and file name; this exact name must be typed to trigger the redirect.
5. In the large blank, enter the full URL for the redirect target; include http:// or https:// (e.g. http://speedhost.in)
6. Leave the other settings as they are, unless you know why you want to change them.
7. Click the Add button and you are done.

The above would make an entry directly to your .htaccess file. If you would like to do a 301 redirect in the .php file itself, then you can use the below code to accomplish the same.

<?
Header( "HTTP/1.1 301 Moved Permanently" ); 
Header( "Location: http://www.new-url.com" ); 
?>