Posted By

dertimbo on 03/24/09


Tagged

redirect htaccess www rewrite


Versions (?)

Who likes this?

4 people have marked this snippet as a favorite

rezzz
rombob
michaelfox
vali29


Rewrite URLs to force WWW


 / Published in: Apache
 

A more generic and portable snippet

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

Report this snippet  

Comments

RSS Icon Subscribe to comments
Posted By: iso100 on July 13, 2010

Here's another option:

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

You need to login to post a comment.