Created
November 11, 2010 02:06
-
-
Save drench/671867 to your computer and use it in GitHub Desktop.
Wordpress: https for login, admin, shopping; http for everything else
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Did the user hit a page that should be https that should be http? | |
# Yes: redirect to https: | |
RewriteCond %{HTTPS} off | |
RewriteCond %{REQUEST_FILENAME} !-f | |
RewriteCond %{REQUEST_FILENAME} !-d | |
RewriteRule ^(wp-admin|wp-login|wp-register|products-page)/.*$ https://wordpress.example.com/$1 [R=301,L] | |
# Did the user hit a page that should not be https, under https? | |
# Yes: redirect to http: | |
RewriteCond %{HTTPS} on | |
RewriteCond %{REQUEST_FILENAME} !-f | |
RewriteCond %{REQUEST_FILENAME} !-d | |
RewriteCond %{REQUEST_URI} !^/products-page/.* | |
RewriteCond %{REQUEST_URI} !^/wp-(admin|login|register).* | |
RewriteRule ^(.*/)$ http://wordpress.example.com/$1 [R=301,L] | |
# did the user hit the root with https? | |
# Yes: redirect to http: | |
RewriteCond %{HTTPS} on | |
RewriteRule ^$ http://wordpress.example.com/ [R=301,L] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment