Redirect Users to www

I’ve always been annoyed by people accessing my sites without using www (i.e. requesting cellarspot.com instead of www.cellarspot.com). This is annoying because it can hurt SEO and it also confuses Google Analytics. I’ve found a fix!

Using Apache mod_rewrite you can create a rule as follows, either in httpd.conf or in a .htaccess file:
sh: /usr/bin/states: No such file or directory

  • http://www.agoodreed.com Huckleberry Hart

    Good snag Al. You are a nerd. Oh wait, I wrote this from my phone while snowboarding.

  • http://sunilgarg.com/ Sunil Garg

    Is there any reason you chose to add “www” rather than remove it?

    Mail servers do not require you to send emails to recipient@mail.domain.com. Likewise, web servers should allow access to their pages though the main domain unless a particular subdomain is required.

    Succinctly, use of the www subdomain is redundant and time consuming to communicate.

  • http://www.alexloddengaard.com Alex Loddengaard

    I’m not sure why I like having the www. I’ll think about this, Sunil, and maybe make a post about how to remove the www. Speaking of which, the article I linked to has code that allows you to remove www.