How to redirect domain.com to www.domain.com

Most sites can be reached by two different URLs. Some sites however will redirect a visitor from domain.com to www.domain.com - this is essential when you are installing an SSL Certificate. For example, we redirect visitors from aryanict.com to www.aryanict.com automatically.

Setting up a www redirect will tell any search engines to go to www.yourdomain.com and if you issue an SSL Certificate to the www. version it will also ensure that no visitors every see an invalid ssl certificate by visiting yourdomain.com

If you are on an Apache webserver, you can use mod_rewrite in order to redirect all traffic that goes to thedomain to the "www" domain.

Try adding this to a file named ".htaccess" at the root of your site (create that file if it doesn't exist):

	RewriteEngine On  
RewriteBase /
RewriteCond %{HTTP_HOST} ^yourdomain.com$
RewriteRule ^(.*)$ http://www.yourdomain.com/$1 [R=301,L]

Note: If you are using an SSL Certificate then be sure to change the http:// to https://

This kind of redirect will work on all of our hosting services.


  • 19 Users Found This Useful
Was this answer helpful?

Related Articles

How to generate a CSR in cPanel

How to generate a CSR in cPanelThe following instructions are for cPanel 11. If you have a...

Browsers are saying that something is not trusted.

The certificate domain name must match the URL you are visiting. Check again using 'View...

Can I transfer my current SSL to my new hosting?

You can take your SSL certificate and install it on your new hosting. The certificate will need...

Am I allowed to keep my private Whois when buying SSL

If your domain name is registered BY-PROXY or the WHOIS information is not publicly displayed you...

Do I need to do anything with my certificates if I change servers or ips?

You will use the same certificate codes, but must reinstall on the new server or IP.