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 already have a rewrite rule in .htaccess. My old rule replaces all html extensions with php. My .htaccess:

RewriteEngine On
RewriteRule ^(.*).html$ index.php?set=$1

Now we have a SSL so now I want to redirct all url http to https with out affecting my old rule. I tried:

RewriteEngine On
RewriteRule ^(.*).html$ index.php?set=$1RewriteCond %{HTTPS} off
RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [R=301,L]
RewriteRule ^(.*).html$ index.php?set=$1

With this, the https redirect is working but my old rule failed.

share|improve this question

Instead of using rewrite for everything, why don't you use redirect to redirect all http connections to https?

Redirect /

Only add this redirect to the http virtual host (I'm assuming you're using virtual hosts to implement the https site).

share|improve this answer

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.