We Value Your Privacy

We and our partners use technology such as cookies on our site to personalise content and ads, provide social media features, and analyse our traffic. Click below to consent to the use of this technology across the web. You can change your mind and change your consent choices at anytime by returning to this site.

Update Consent
Loading ...

How do I add WWW to my domain name?

Updated April 17, 2017

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.

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

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

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

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

  5. Type the following in the "Content" box:

  6. yourdomain.com.

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

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

  9. Click "Save Record."

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

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

  12. ssh yourdomain.com

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

  14. Enter your username and password as directed.

  15. Type the following to edit your Apache configuration file:

  16. sudo nano /etc/apache2/apache2.conf

  17. Locate a line that looks something like this:

  18. ServerName yourdomain.com

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

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

  21. Hit "Enter" to start a new line.

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

  23. ServerAlias www.domain.com

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

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

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

  27. sudo /etc/init.d/apache 2 reload

  28. Tip

    Consult your web host if you need help configuring a WWW subdomain. Certain free and low-cost hosts may not offer this option.


    Certain methods of adding the WWW sub-domain mean search engines will interpret yourdomain.com and www.yourdomain.com as two separate sites, which can hurt search rankings. See Resources for more information.

Loading ...

About the Author

Loading ...