How to Redirect Non-WWW to WWW URLs

Search engines consider http://website.com and http://www.website.com as 2 different websites. As a result, if the website has been linked to from other websites using a mix of the two URLs the potential benefit of valuable link popularity are effectively splited.

By using a 301 redirect on the “non-www” version of the URL, which is essentially a “permanent” redirect in server talk, we can effectively consolidate all of your link popularity to a single URL. This consolidation will serve to increase the website’s chances of obtaining and maintaining top rankings.

The server hosting the website needs to be set to redirect the traffic seamlessly. In Apache web server, make sure mod_rewrite is enabled.  This is done by uncommenting the following line:

LoadModule rewrite_module modules/mod_rewrite.so

Once enabled, add the following lines in httpd.conf:

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

Reload Apache by running

/sbin/service httpd reload

 

Reference:

http://www.stepforth.com/resources/web-marketing-knowledgebase/non-www-redirect/#apache

Advertisements

One thought on “How to Redirect Non-WWW to WWW URLs

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s