Skip to content

Instantly share code, notes, and snippets.

@rsobers
Created April 22, 2014 00:30
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rsobers/11161366 to your computer and use it in GitHub Desktop.
Save rsobers/11161366 to your computer and use it in GitHub Desktop.
# Ensure www on all URLs.
RewriteEngine On
RewriteBase /
RewriteCond %{HTTP_HOST} !^www\. [NC]
RewriteCond %{HTTP_HOST} ^([^.]+\.[a-z]{2,6})$ [NC]
RewriteRule ^(.*)$ http://www.%1/$1 [R=301,L]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment