Skip to content

Instantly share code, notes, and snippets.

@anova
Created July 24, 2013 07:22
Show Gist options
  • Save anova/6068635 to your computer and use it in GitHub Desktop.
Save anova/6068635 to your computer and use it in GitHub Desktop.
.htaccess for www enforcement and wordpress. (helicon)
# BEGIN WordPress
RewriteEngine on
RewriteBase /
#enforce www
#http://stackoverflow.com/a/4958847/181295
RewriteCond %{HTTP_HOST} !^$
RewriteCond %{HTTP_HOST} !^www\. [NC]
RewriteCond %{HTTPS}s ^on(s)|
RewriteRule ^ http%1://www.%{HTTP_HOST}%{REQUEST_URI} [R=301,L]
#to use relative paths in RewriteMap, map files must reside in the same folder as .htaccess
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [NC,L,NS]
# END WordPress
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment