I have two pages on my Wordpress site that need to be served as https; the rest is vanilla http. Pushing the whole site to https would involve a lot of database editing to avoid mixed content, so I'm looking to write an htaccess script to use a RewriteRule that will make the change just for those two pages.
The browser addresses for the two pages are like http://example.com/draw/membership-login/ and http://example.com/draw/membership-join/membership-registration/ Note they both contain the word 'membership' and no other page does (or so I believe), so I thought I'd write a rule to look for any REQUEST_URI containing 'membership'. I did this and put it before Wordpress's own script in .htaccess (.htaccess is in directory draw, the home directory for the Wordpress installation). It looks like this (only the first 4 lines are mine; the rest is WordPress's, except I've commented out their RewriteEngine On).
RewriteEngine On
RewriteCond %{HTTPS} off
RewriteCond %{REQUEST_URI} membership
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [R=302, L]
# BEGIN WordPress
<IfModule mod_rewrite.c>
#RewriteEngine On
RewriteBase /draw/
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /draw/index.php [L]
</IfModule>
# END WordPress
Result? All pages serve ok except the two membership pages, which serve as 404.
I guess it's good news in a sense, as the RewriteCond must be finding the membership pages, but the RewriteRule is clearly not delivering what I had hoped.
Any help much appreciated.