Skip to content

Instantly share code, notes, and snippets.

@raf-sh
Created March 31, 2015 12:55
Show Gist options
  • Save raf-sh/0cafb9f40d3b967fce79 to your computer and use it in GitHub Desktop.
Save raf-sh/0cafb9f40d3b967fce79 to your computer and use it in GitHub Desktop.
redirect to no-www and from index.(php|html|htm) to /
RewriteEngine on
RewriteCond %{HTTP_HOST} ^www\.(.*)$ [NC]
RewriteRule ^(.*)$ http://%1%{REQUEST_URI} [R=301,QSA,NC,L]
RewriteCond %{THE_REQUEST} ^.*/index\.(php|html?)
RewriteRule ^(.*)index.(php|html?)$ /$1 [R=301,NC,L]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment