Skip to content

Instantly share code, notes, and snippets.

@Gkiokan
Created September 12, 2017 10:58
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Gkiokan/72166fa149f9e19e240eed57be70e119 to your computer and use it in GitHub Desktop.
Save Gkiokan/72166fa149f9e19e240eed57be70e119 to your computer and use it in GitHub Desktop.
The WPMS non-www to www but grant access to wp-* problem in htaccess
RewriteEngine On
RewriteBase /
RewriteCond %{HTTP_HOST} ^domain\.com$
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} !^/wp-admin
RewriteCond %{REQUEST_URI} !^/wp-json
RewriteRule ^(.*)$ http://www.domain.com/$1 [R=301,L]
RewriteCond %{HTTP_HOST} ^domain\.com$ [NC]
RewriteRule ^$ http://www.domain.com/$1 [L,R=301]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment