Skip to content

Instantly share code, notes, and snippets.

@ajithrn
Created February 25, 2014 16:09
Show Gist options
  • Save ajithrn/9211976 to your computer and use it in GitHub Desktop.
Save ajithrn/9211976 to your computer and use it in GitHub Desktop.
htaccess: prepend www
#add www.infront of 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