Removing the “www” sub-domain in Apache

The consensus is clear. You don’t like websites that force you to use the “www” sub-domain, making everyone type www.example.com rather than just example.com. So how do you fix it? With Apache, the world’s most popular web server software, it’s easy.

There’s three things to do.

  1. Make sure you have DNS entries to provide an IP address for both the domain example.com itself and the www sub-domain.
  2. Make sure you have Apache configured to serve out your website to both of those domains.
  3. (Optional) Add a URL re-writing rule so that whichever way users type the website address, their browser will always display your preferred default, with or without the www.

Continue reading “Removing the “www” sub-domain in Apache”