Skip to content

Instantly share code, notes, and snippets.

@Shaz3e
Created February 22, 2014 15:29
Show Gist options
  • Save Shaz3e/9156616 to your computer and use it in GitHub Desktop.
Save Shaz3e/9156616 to your computer and use it in GitHub Desktop.
# add www to any url
RewriteEngine on
RewriteCond %{HTTP_HOST} !^www\.domain\.com [NC]
RewriteRule ^(.*)$ http://www.domain.com/$1 [L,R=301]
# remove www from any url
Options +FollowSymlinks
RewriteEngine on
RewriteCond %{HTTP_HOST} ^www\.domain\.com [NC]
RewriteRule ^(.*)$ http://domain.com/$1 [L,R=301]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment