Redirecting Webpage To WWW Prefix

Published May 24th 2009 by
Filed under HTML

When a domain is entered in a browser, it can be entered with or without the www prefix. For example, can be reached from either or Search engines will pick this up as 2 different webpages which will half your ranking on the search engines search results. There is a way to make make it a single webpage using a redirection. You must choose to either use the www prefix or not. To do this, make a new .htaccess file or edit an existing one in the root of where your site is hosted. In the .htaccess file, enter the following replacing the url with your own:

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteCond %{HTTP_HOST} !^www\.let-go\.net [NC]
RewriteRule ^(.*)$$1 [L,R=301]

Save the file and upload it. This will redirect your site to the www prefix when the prefix is not entered making it one webpage on search engines. To redirect it to exclude the www prefix, take out “www\.” and the “www.” in the code above.