Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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?

share|improve this question

2 Answers 2

up vote 0 down vote accepted

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)
share|improve this answer
    
Actually had to do it like this: ^/(register|inc/dues_login/ABC|inc/dues_login/DEF... –  MB34 Aug 30 '12 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 '12 at 16:54

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]
share|improve this answer
    
That didn't work, see my comment on @brain99's answer. –  MB34 Aug 30 '12 at 16:46

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.