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

Check with RewriteCond if QUERY_STRING is empty and if HTTPS is "off" before redirecting the client with a RewriteRule.

share|improve this answer
RewriteCond %{HTTPS} !=on RewriteCond %{THE_REQUEST} ^([^?]+)$ RewriteRule ^(.*)$ https://%{SERVER_NAME}/$1 [R,L] – jalal allam Oct 26 '10 at 13:53
but not work probable – jalal allam Oct 26 '10 at 13:54
THE_REQUEST is the wrong variable, use the one I've mentioned. Also SERVER_NAME should be HTTP_HOST. – joschi Oct 27 '10 at 6:16

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.