How Do I Add WWW to My Domain Name?

Techwalla may earn compensation through affiliate links in this story. Learn more about our affiliate and product review process here.
It's important that domains also be accessible with the WWW prefix.

A basic domain name—for example, yourdomain.com—is 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 "yourdomain.com" and "www.yourdomain.com." 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.

Advertisement

If You Can Modify Your DNS Records

Video of the Day

Step 1

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

Video of the Day

Step 2

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

Advertisement

Step 3

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

Step 4

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

Advertisement

Step 5

Type the following in the "Content" box:

yourdomain.com.

Replace "yourdomain.com" with your specific domain name.

Advertisement

Step 6

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

Step 7

Click "Save Record."

Apache Web Server Users

Step 1

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.

Advertisement

Advertisement

Step 2

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

ssh yourdomain.com

Replace "yourdomain.com" with your specific domain name.

Advertisement

Step 3

Enter your username and password as directed.

Step 4

Type the following to edit your Apache configuration file:

sudo nano /etc/apache2/apache2.conf

Advertisement

Step 5

Locate a line that looks something like this:

ServerName yourdomain.com

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

Advertisement

Step 6

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.)

Advertisement

Step 7

Hit "Enter" to start a new line.

Advertisement

Step 8

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

ServerAlias www.domain.com

Replace "domain.com" with your specific domain name.

Advertisement

Step 9

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

Step 10

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

sudo /etc/init.d/apache2 reload

Advertisement

Advertisement

references & resources