Depending on your web host server, you may come across issues where your domain name re-writes itself to one without the ‘www’.

A simple example would be:

http: //your-domain.com

that should be

http: //www.your-domain.com

How to correct this

Edit your .htaccess file with the following code:

[source]

Options +Includes
RewriteEngine On
RewriteCond %{HTTP_HOST} !^www.yours.com$ [NC]
RewriteRule ^(.*)$ http://www.yours.com/$1 [L,R=301]

[/source]

Great resource for .htaccess mod_rewrite

http://www.ilovejackdaniels.com/cheat-sheets/mod_rewrite-cheat-sheet/

Posted by Anton on Saturday, April 12th, 2008

One Response to “Re-writing non-www to www domain” Add your own

Post A Comment