Thursday, August 11, 2011

How To Use 301 Redirect With .htaccess

Hello Friends, 301 Redirect is the service that redirect us to our new url

A brief introduction about 301 redirection or URL canonical are :-
301 Redirect is a most commonly and sufficiently used redirection method for search engines and user. The use of 301 redirect is when you change the name of page or website to new one. If you are here then that mean you know what is 301 redirect . I am going to tell how to implement it in your website or blog. This is very easy. For doing 301 redirection you need a .htaccess code. The code is following.



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


second code is

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

No need to mention any url in this code. Just upload this and your site will be redirect.

In this code just change the name of your old website instead of "domain.com" and change the "http://www.domain.com" with new domain name. Else is same. Now your code for 301 redirection is ready. Now just upload it in .htacces file and take the beneficial of 301 redirection. Don't Forget to leave a comment.
If This post help you then Like my Facebook fan page and follow my blog.

No comments:

Post a Comment

Please don't leave link in comment....