Navigation


301 Redirect

10:12 AM, Posted by Mini, No Comment

301 Redirect is known as one of the most search engine friendly method for a web page redirection. It is the most safest method for redirection and it also preserves search engine rankings for a particular page.Whenever it is needed to change any file and move pages around it is the most safest option.

.htaccess 301 Redirect

One of the simplest way to redirect is the use of .htaccess redirect. .htaccess redirect helps in redirecting a non www domain to www domain. Means it will redirect the domain.com to www.domain.com. For this redirection we need to create a simple .htaccess file with the code below.

Options +FollowSymlinks
RewriteEngine on
rewritecond %{http_host} ^domain.com [nc]
rewriterule ^(.*)$ http://www.domain.com/$1 [r=301,nc]

You need to replace the domain.com and www.domain.com with your website's actual name. Create the .htaccess file with the code above and place it in the root directory of your website.

Note* The .htaccess method given above works only on Linux servers having the Apache Mod-Rewrite module enabled in it.