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.

My site has a normal SSL installed and these are the changes I made in .htaccess

RewriteEngine On 
RewriteCond %{HTTPS} off
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI}
RewriteCond %{HTTP_HOST} !=blog.mysite.com

But I want https://blog.mysite.com to redirect to http://blog.mysite.com

share|improve this question

migrated from stackoverflow.com Aug 26 '12 at 6:31

This question came from our site for professional and enthusiast programmers.

And what have you tried? –  Michał Górny Aug 25 '12 at 8:03
Sorry for the incomplete problem. Actually when I open blog.mysite.com it shows a SSL error. –  user1624228 Aug 25 '12 at 9:37

1 Answer 1

How about something like:

RewriteEngine On

RewriteCond %{HTTPS} off
RewriteCond %{HTTP_HOST} !^blog.assurehosts.com$
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [R=301,L]

RewriteCond %{HTTPS} on
RewriteCond %{HTTP_HOST} ^blog.assurehosts.com$
RewriteRule (.*) http://%{HTTP_HOST}%{REQUEST_URI} [R=301,L]

Just note I'm writing it off top of my head; I don't have any server nearby to test it.

edit: added R=301 to make this a permanent redirect since that's what you probably want; and L to make sure following rules won't be applied if one matched already — I just recalled it.

share|improve this answer
PERFECT! Thanks! –  user1624228 Aug 25 '12 at 9:54
I've just reordered yours and added the opposite. You could do that yourself ;P. –  Michał Górny Aug 25 '12 at 9:56
Haha thanks anyways. I can ask my senior to provide you a Hosting account for free! Just drop me your email and domain at aman@assurehosts.com if you need it. :) –  user1624228 Aug 25 '12 at 9:57
I've also added 'permanent redirect' flag to the snippet, you'd probably want that to make browser remember the redirect and perform it without asking the server in the future. –  Michał Górny Aug 25 '12 at 19:49

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.