Skip to content

Instantly share code, notes, and snippets.

@dmitrymomot
Created July 7, 2014 11:22
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 dmitrymomot/c0fd8c6e0bbd7f64dbe0 to your computer and use it in GitHub Desktop.
Save dmitrymomot/c0fd8c6e0bbd7f64dbe0 to your computer and use it in GitHub Desktop.
### redirect from www to non-www
# ----------------------------------------------------------------
# Options +FollowSymLinks
# RewriteEngine On
# RewriteCond %{HTTP_HOST} ^www.site.com$
# RewriteRule (.*) http://site.com/$1 [R=301,L]
# RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /index\.html\ HTTP/
# RewriteRule ^index\.html$ http://site.com/ [R=301,L]
# RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /index\.php\ HTTP/
# RewriteRule ^index\.php$ http://site.com/ [R=301,L]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment