Skip to content

Instantly share code, notes, and snippets.

@zerolab
Created November 4, 2014 15:26
Show Gist options
  • Save zerolab/f8eee46db9f1ff7019d7 to your computer and use it in GitHub Desktop.
Save zerolab/f8eee46db9f1ff7019d7 to your computer and use it in GitHub Desktop.
Apache www to non-www redirect
<IfModule mod_rewrite.c>
RewriteEngine On
# redirect to non-www
RewriteCond %{HTTP_HOST} ^www\.(.*) [NC]
RewriteRule ^(.*)$ http://%1/$1 [R=301,L]
</IfModule>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment