tutorialtastic

Forcing "www." in Your URL

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

The opposite of the Removing "www." From Your URL snippet. Create a file called .htaccess and add the snippet, replacing domain.com with your actual domain name. On the second line the full stops (periods) are escaped with the backslash - make sure you do the same. E.g. a .co.uk domain would be escaped as \.co\.uk

Microsoft Windows users will not be able to create a file called ".htaccess" on their computer. Upload the file as htaccess.txt and rename it on your server.

Category: Other
Rating:
Added: 23rd November 07 by Jem
Bookmark At: StumbleUpon, Digg

tutorialtastic — ultimately better than pixelfx
Copyright © Jem Turner 2003-08. (About | Disclaimer | Link In)