Greg Hewgill (ghewgill) wrote,
Greg Hewgill
ghewgill

the accursed www

The common www part of web server addresses has annoyed me for a long time. It's unnecessary, ugly, and annoying to pronounce. There is even a site, no-www, that is dedicated to the effort of eliminating the www wart on web addresses.

dbaker today pointed me to an easy way to eliminate the www using Apache. Instead of using the cumbersome mod_rewrite as suggested on the no-www site, do something like this:

<VirtualHost *>
    ServerName www.example.com
    Redirect permanent / http://example.com/
</VirtualHost>

Then, remove the ServerName www.example.com line from the real server configuration section. This assumes that you are using NameVirtualHost, which isn't the default but probably should be.

This configuration quietly redirects any URL with www to the corresponding URL without. This improves the way your URL looks, improves search engine efficiency, and promotes world peace. Well, maybe not that last thing.

Tags: web
Subscribe

  • islands of the world tour 2009

    Amy and I haven't been back to North America to see family since we got married in 2007. We've been talking for a while about taking a trip back,…

  • changing travel plans

    Things are suddenly moving fast. It looks like Amy and I are going to try to make it to Austin in time for SXSW (that means leaving Canada around…

  • photos from the usa southwest trip

    I've finished culling, sorting, and organizing the photos that I took during our trip. There are 339 photos, 132 of which are in the "60 mi Gallery"…

  • Post a new comment

    Error

    Anonymous comments are disabled in this journal

    default userpic

    Your reply will be screened

    Your IP address will be recorded 

  • 7 comments