Skip to content

Instantly share code, notes, and snippets.

@susanBuck
Created February 26, 2014 22:48
Show Gist options
  • Save susanBuck/9240424 to your computer and use it in GitHub Desktop.
Save susanBuck/9240424 to your computer and use it in GitHub Desktop.
Remove WWW from urls
RewriteEngine On
# Remove www from host (for both http and https)
RewriteCond %{HTTP_HOST} ^www\.(.+)
RewriteCond %{HTTPS}s/%1 ^(on(s)|offs)/(.+)
RewriteRule ^ http%2://%3%{REQUEST_URI} [L,R=301]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment