0

How can write rewriterule to redirect just:

http://example.com/index.php to https://example.com/index.php

And anything else stays the same

ex: http://example.com/index.php?a=2&lang=English remains as it is http://example.com/index.php?a=2&lang=English

1 Answer 1

1

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

3
  • RewriteCond %{HTTPS} !=on RewriteCond %{THE_REQUEST} ^([^?]+)$ RewriteRule ^(.*)$ https://%{SERVER_NAME}/$1 [R,L] Oct 26, 2010 at 13:53
  • but not work probable Oct 26, 2010 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, 2010 at 6:16

You must log in to answer this question.

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