Forum Topic: Force redirect of directories to https

Forum: .htaccess Forum : Redirecting • Posted by James MacDonald • Updated:

I am running the latest version of WordPress (3.5.1). I have some areas of the site I’d like to force to use https. I’ve had some success – particularly these are working to force use of https:

RewriteCond %{HTTPS} on
RewriteCond %{REQUEST_URI} !^(/wp-admin*)
RewriteCond %{REQUEST_URI} !^(/wp-content*)
RewriteCond %{REQUEST_URI} !^(/wp-login.php*)
RewriteCond %{REQUEST_URI} !^(/wp-includes*)
RewriteCond %{REQUEST_URI} !^(/phpMyAdmin*)
RewriteRule ^(.*)$ http://%{HTTP_HOST}%{REQUEST_URI} [R=301,L]

However, I just installed an events plugin that requires users to login on the page to register for an event. I’d like those pages to be secured. I believed I could just add:

RewriteCond %{REQUEST_URI} !^(/events*)

As all the events pages with logins are located within this directory

It’s not working and I’m stumped.

1 Reply to “Force redirect of directories to https”

Posted by Jeff Starr

Hi James,

I’ve seen something similar and remember resolving the issue by relocating the rewrite rules to appear before the WP permalink rules. That’s the first thing I would try..