How do I add WWW to my domain name?

WWW 88 image by chrisharvey from

A basic domain name---for example, usually all that's necessary to load a website in a web browser. However, adding the prefix "www." before the domain name has become a standard convention, and it's a good idea for every website to be accessible via both "" and "

" The "www." portion of the URL is known as a sub-domain. Enabling sub-domains can be challenging for a beginner, but it's certainly not impossible.

Log in to the DNS control panel provided by your web host.

Add a new record. (This is often done by pressing an "Add Record" or "+" button.)

Type "www" (without the quote marks) in the "Name" field.

Type "CNAME" (without the quote marks) in the "Type" box or choose "CNAME" from the "Type" drop-down list.

Type the following in the "Content" box:

Replace "" with your specific domain name.

Type "3600" (without the quote marks) in the "TTL" box.

Click "Save Record."

Launch your preferred terminal program. On Mac OS X, this is usually Terminal (accessible via the dock); on Windows, type "cmd" (without the quote marks) into the "Run" menu off of the Start Menu.

Type the following to connect to your server via the command line (also known as SSH):


Replace "" with your specific domain name.

Enter your username and password as directed.

Type the following to edit your Apache configuration file:

sudo nano /etc/apache2/apache2.conf

Locate a line that looks something like this:


(Instead of "" it should have your domain name listed.)

Move the blinking prompt to the very end of the ServerName line with your keyboard's arrow keys. (Your mouse will not work in this interface.)

Hit "Enter" to start a new line.

Paste the following (Ctrl+V on Windows, Cmd+V on Macs) on this blank line:


Replace "" with your specific domain name.

Type Ctrl+X to quit the editing program. Hit "Enter" to confirm your saved changes. You will be brought back to the command line.

Type the following to restart Apache, which is necessary to make your changes:

sudo /etc/init.d/apache 2 reload