Posted By

theworldofdan on 07/21/11


Versions (?)

Who likes this?

1 person have marked this snippet as a favorite


redirect to www. domain without needing to hardcode domain

 / Published in: Apache

  1. <IfModule mod_rewrite.c>
  2. RewriteEngine On
  3. RewriteBase /
  4. # redirect non-www to www
  5. RewriteCond %{HTTP_HOST} ^([a-z-]+)\.([a-z]{2,6})$ [NC]
  6. RewriteRule ^(.*)$ http://www.%1\.%2/$1 [R=301,L]
  7. </IfModule>

Report this snippet  

You need to login to post a comment.