How to Add www. to Your Domain Name

When you register a domain name and publish your website, initially your website does not have www. part in its domain. Let's say you registered

as your domain. When you publish your website, it will be accessible through

Now, you can continue using that way or modify it so that it will be located at

There is no right or wrong way to do this. You can go with either option. However, from the SEO (Search Engine Optimization) point, you should decide on one of them and continue with it for the rest of the life of your website. Simply because and are not exactly the same thing from a search engine crawler's perspective, so if people give links to either URL, the other will not benefit from it unless you have proper redirection.

Another important point is that if you are using either one of them without redirecting the other one to the one that you are using, visitors may get an error when trying to access your website. For example, if you are using and you are not redirecting to, then if a visitor types in the address bar, the website will not load and give an error. This is an important thing to keep in mind and you may lose visitors because of this.

In summary, you can choose either option but you should choose it before even publishing your website and stick to it.

Having said that, let's continue with how to add www. to your domain name:

How to Add www. to a Domain Name

1. Go to the root directory of your website. If your domain is a stand-alone domain, its root folder is the public_html folder. If your domain is an addon domain, its root folder is the domain folder that was created when you added your domain to your hosting account.

2. Find the .htaccess file in the root directory. If there is no .htaccess file, you can create it yourself with the File Manager or a text editor (if your server has necessary permissions). Note that the name of the file is exactly .htaccess and it doesn't have another word before the dot.

3. Copy and paste the following code into your .htaccess file:

RewriteEngine On
RewriteCond %{HTTP_HOST} ^$ [NC]
RewriteRule ^(.*)$$1 [L,R=301]

How to Add www. to Your Domain Name

4. Replace example with your own domain name and then save the file. If you created a new .htaccess file, make sure it is in the root directory of your website.

The above code basically redirects visitors and search engine crawlers to if somehow they land on It means, when you type in the address bar of your browser, it will automatically redirect to

Was this post helpful?

If you found this post to be helpful, please share it! Thank you :)

f t g+ in