URL Rewriting: Redirecting To A Single Domain

Filed under SEO, Tutorials

I personally prefer to have a single domain name and will do redirect 301 response header all the others, in maximizing my page ranking.

Well, to make it simple, the whole idea here is to take a domain like http://kontrapelo.com and redirect it to http://www.kontrapelo.com consolidating all incoming links to a single domain, wether they use “www” or not.

Here’s a simple mod_rewrite rule you can add to .htaccess to accomplish this, put it above any other rewrite rules that you are using, you may want the other rules to apply to the www. domain after the initial redirect.

note: replace the sample domain with your own domain.
RewriteEngine on

#Redirect http://kontrapelo.com to http://www.kontrapelo.com
RewriteCond %{HTTP_HOST} ^kontrapelo.com
RewriteRule ^(.*)$ http://www.kontrapelo.com/$1 [r=301,L]

Post a Comment

Your email is never published nor shared. Required fields are marked *

*
*