0

I have this rewrite rule:

RewriteEngine on
RewriteCond %{REQUEST_URI} ^/(register|login)
RewriteCond %{HTTPS} !=on
RewriteRule (.*) https://%{SERVER_NAME}/$1 [L,R]

I have several others that I need to force HTTPS like this:

http://www.mysite.com/inc/dues_login/ABC
http://www.mysite.com/inc/dues_login/DEF
http://www.mysite.com/inc/dues_login/GHI

How would I make these also forced to https?

2 Answers 2

0

You can simply extend your current condition:

RewriteCond %{REQUEST_URI} ^/(register|login|inc/dues_login)

This is assuming that any url starting with http://www.mysite.com/inc/dues_login should be forced to use https.

If you only want to redirect the specific paths you listed to https:

RewriteCond %{REQUEST_URI} ^/(register|login|inc/dues_login/ABC|inc/dues_login/DEF|inc/dues_login/GHI)
2
  • Actually had to do it like this: ^/(register|inc/dues_login/ABC|inc/dues_login/DEF...
    – MB34
    Aug 30, 2012 at 16:45
  • D'oh! I had missed the /inc/ part in your urls and just copy/pasted one in my answer. Of course that's what it should be.
    – brain99
    Aug 30, 2012 at 16:54
0

You can just add the dues_login as a RewriteCond

    RewriteEngine on
    RewriteCond %{REQUEST_URI} ^/(register|login|dues_login)
    RewriteCond %{HTTPS} !=on
    RewriteRule (.*) https://%{SERVER_NAME}/$1 [L,R]
1
  • That didn't work, see my comment on @brain99's answer.
    – MB34
    Aug 30, 2012 at 16:46

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .