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

What's wrong with these redirect rules?

RewriteEngine On
RewriteBase /
RewriteCond %{HTTP_HOST} =www.pointfixed.com
RewriteCond %{HTTPS} on
RewriteRule ^$ http://www.pointfixed.com/ [L,R=301]

What I'm trying to do with these rules is forward https to http for the root of the www domain only.

Just those urls and no more than that. No subdirectory redirects, etc. Just if someone tries to access the base url https forward to http.

Anyone know what I'm doing wrong?

share|improve this question

2 Answers 2

up vote 0 down vote accepted

You can also do it via:

RewriteEngine on
RewriteBase /
RewriteCond %{HTTPS} on
RewriteCond %{HTTP_HOST} =www.example.tld
RewriteRule ^$ http://%{HTTP_HOST}

That one should work as expected (it did on my domain), hopefully. And meet the criteria of the question this time.

share|improve this answer
    
I was going to say the same but then I saw "Just those urls and no more than that. No subdirectory redirects, etc. Just if someone tries to access the base url https forward to http." ... so (.*) won't do what he wants. –  ETL Apr 19 '13 at 0:23
    
Yeah, this isn't exactly what I'm asking for. I'm looking for just the root. –  Dan Rice Apr 19 '13 at 0:32
    
Whoops, yeah, right you are. Edited to reflect the actual question. –  nerve Apr 19 '13 at 0:55
    
Thanks this worked after a few days. I think my host was caching the htaccess file. –  Dan Rice Apr 22 '13 at 17:50
RewriteRule ^$ http://www.pointfixed.com/ [L,R=301]

That would mean rewrite "" to http://...

^ means start of string. $ means end of string.

You probably meant

RewriteRule ^/$ http://www.pointfixed.com/ [L,R=301]
share|improve this answer
    
I tried that, but it doesn't seem to be working. I am still able to view the https site. I would try on another domain, but this is the only domain I own that has https. Also , it's a dynamic cloud managed site so I can't look at the .htaccess log. I'm wondering if it's just a bug with my provider. –  Dan Rice Apr 19 '13 at 0:31
    
Do you have any other configuration somewhere? I never myself used the .htaccess to control things on Apache as I use it only for proxying so maybe the issue is along the lines on how to put this in the .htaccess file. –  ETL Apr 19 '13 at 0:37
    
It's working now! Looks like there was a caching delay and now after a few days it started working. –  Dan Rice Apr 22 '13 at 17:49

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.