Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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:

How would I make these also forced to https?

share|improve this question
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 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


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.