0

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

2
  • And what have you tried? Aug 25, 2012 at 8:03
  • Sorry for the incomplete problem. Actually when I open blog.mysite.com it shows a SSL error.
    – user1624228
    Aug 25, 2012 at 9:37

1 Answer 1

0

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.

3
  • I've just reordered yours and added the opposite. You could do that yourself ;P. Aug 25, 2012 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 [email protected] if you need it. :)
    – user1624228
    Aug 25, 2012 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. Aug 25, 2012 at 19:49

You must log in to answer this question.