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

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

1 Answer 1

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

Redirect / https://your.server.com/

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

 
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.