Remove the www from URLs

axe.jpgAwhile back, I did a quick tutorial on how to remove the index.html and index.php files from your urls.  I did it because having both in my stats was driving me nuts and causing dupe urls within Google as well.  That splits apart any SEO benefit from inbound links and makes dealing with stats numbers a royal pain.

Another problem is with the www bit in the urls.  I know I’m infamous for point out how folks misuse the www bit this all the time as some networks still have problems resolving urls when an extra layer is added to the domain.

The problem though some people have when setting up such a feature is that they make the with-www or without-www not resolve.  That’s an issue because you’re losing half of the folks don’t use domains the same way you do.

Another problem is that you’re splitting in half any SEO benefit you may get from inbound links.  Some folks will link to your site with the www included, some will not use the ‘www’ bit.  Better to get benefit from all of the inbound links.

Best solution is to redirect visitors to one or the other.  For me, it’s easier to strip out the ‘www’ and try and force it.  You can do that with the following code added to your .htaccess file within root:

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

The domain.com bit needs to be replaced with the correct domain for your site of course.  And you may already have the first line in your .htaccess file.

It would be easier (and require less server load) to make this change within the Apache configuration files but not everybody has access to the root files on a server.

Of course now we’ll have to deal with the no-www and yes-www crowds.

Leave a Reply

Your email address will not be published. Required fields are marked *