Here is some code that will allow you to make all requests to your site have "www" in front of it.

All sites we host by default can be accessed with and without the www, but some of you would like "www" only style URLs. Modify your .htaccess file with the following lines of code, using what is appropriate for your web server version.


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


In Apache 2.x you might try:

Code:

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



Related articles

Related articles appear here based on the labels you select. Click to edit the macro and add or change labels.

Related issues