Knowledgebase: SSL Configuration
How to redirect domain.com to www.domain.com
Posted by Pacific Host on 04 December 2011 02:38 PM

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 pacifichost.com to www.pacifichost.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.

(1 vote(s))
Helpful
Not helpful

Comments (0)