Get Rid Of The ‘WWW’ Prefix – It’s Long Overdue

Want to help support this blog? Try out Oh Dear, the best all-in-one monitoring tool for your entire website, co-founded by me (the guy that wrote this blogpost). Start with a 10-day trial, no strings attached.

We offer uptime monitoring, SSL checks, broken links checking, performance & cronjob monitoring, branded status pages & so much more. Try us out today!

Profile image of Mattias Geniar

Mattias Geniar, November 29, 2008

Follow me on Twitter as @mattiasgeniar

To understand why the “WWW” prefix or subdomain is outdated, we should first look at the original definition of WWW.

World Wide Web

n. Abbr. WWW 

  1. The complete set of documents residing on all Internet servers that use the HTTP protocol, accessible to users via a simple point-and-click system. 
  1. n : a collection of internet sites that offer text and graphics and sound and animation resources through the hypertext transfer protocol.

The important part here is the HTTP Protocol. Whenever a link is made, such as http://, the software will know that a connection to a webserver is made, on port 80. That’s what the http-protocol stands for.

The definition above implies that the “World Wide Web” uses the http protocol to send its data. Why then, do we still need to add the “WWW” subdomain? It’s a waste of time to type it. Wouldn’t it be easier to just type in the domain name, without the “WWW”?

While most webservers will accept traffic on the domain-name, without the WWW prefix, they usually redirect to the WWW-part of the website. Typing http:// will often land you on http://www.. This should be the other way around.

Using the following .htaccess rule, you can safely redirect all traffic from http://www. to the http:// version of your website.

Options +FollowSymlinks
RewriteEngine on
# Remove the WWW subdomain, and redirect to the domain itself
RewriteCond %{http_host} ^www\.domain\.com [NC]
RewriteRule ^(.*)$$1 [R=301,NC]

For more information on what Redirect-Code to use ([R=301]) I kindly refer you to the following page: Using Proper Header Redirects In PHP. There you’ll find a good explanation on the difference in 301 and 302 redirects, and their effect on search engines.

Want to subscribe to the cron.weekly newsletter?

I write a weekly-ish newsletter on Linux, open source & webdevelopment called cron.weekly.

It features the latest news, guides & tutorials and new open source projects. You can sign up via email below.

No spam. Just some good, practical Linux & open source content.