WWW Makes a Difference

January 18, 2010

It’s just three letters, but they have the potential to confuse and deter your web site visitors if you don’t mind them. The letters are “www“. For being a classic part of the internet, this may come as a surprise, but the problem is in the fact that prefixing your domain with www is like creating a subdomain called “www” (I’m not getting into to the nitty details). If you register your security certificate with subdomain or set cookies with the subdomain, rather than the domain itself, users will have issues with your main web site.

The solution is actually quite simple and you can still have the www if you want it. First, set your security certificate to the preferred version of your web site (contact the provider of your certificate for help). Then configure your site to redirect requests to the right version. Finally, either set cookies for your domain preceded by an asterisk and period (*.your-site.tld)

Adjusting for WWW/no WW on Apache Servers
Add the following code to your htaccess file (or create a plain text file .htaccess in your root directory if you don’t have one).
<IfModule mod_rewrite.c>
RewriteEngine On

# To redirect all users to access the site WITHOUT the 'www.' prefix, remove hash (#) on next two lines
# RewriteCond %{HTTP_HOST} ^www\.your-site\.com$ [NC]
# RewriteRule ^(.*)$ http://your-site.com/$1 [L,R=301]

# To redirect all users to access the site WITH the 'www.' prefix, remove hash (#) on next two lines
# RewriteCond %{HTTP_HOST} ^your-site\.com$ [NC]
# RewriteRule ^(.*)$ http://www.your-site.com/$1 [L,R=301]

</IfModule>

If you’re using a Windows server (IIS), view the server documentation and/or contact your host. Sorry, I only have LAMP and WAMP setups available to me, both using Apache.

For information on why many webmasters are switching to using no “www”, visit no-www.org home page.

There are more advanced solutions as well, including multi-domain security certificates. If you need a more complex solution, there are providers of those solutions. This article just covers basic steps that many webmasters, including hobby owners, can implement.

Share |

Leave a Comment

You can use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

CommentLuv Enabled

Spam Protection by WP-SpamFree


Previous post:

Next post:

^ Back to Top