Sign up ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

I have a site that has an SSL certificate on a subdomain, let's call it https:// I want to redirect all https requests on https:// to https://, while still keeping all http requests on http://

Is this even possible? I've googled and nothing really came up.

(The spaces in the protocols are because I cannot post hyperlinks)

Thanks, Luke

edit: Figured it out. This did the trick.

RewriteCond %{HTTPS} on
RewriteRule ^(.*)${REQUEST_URI} [R,L]
share|improve this question
Please answer to yourself and check it as valid – Olivier Pons Mar 13 '12 at 8:36

1 Answer 1

up vote 1 down vote accepted

Use the rewrite module in apache ... the lines you need to place into the vhost for would look something like this (please test first, this is untested):

RewriteEngine On
RewriteCond %{HTTPS} on
RewriteRule (.*)$1

Basically, turn on the engine (line 1), if the the https is "on" (line 2) execute the next line: rewrite the url to ssl main domain (line 3). The third line would work like this: to to

This would only trigger on the condition (RewriteCond) that https is on. When https is off, i.e., http, your traffic should continue go to

Try it out in a test server before running this in production in case this interferes with some other rules. HTH.

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.