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.

I have edited my .htaccess file to redirect any http request to https://mydomain.se however, this has cause the website to fall in redirect loop. I have looked at the other solutions and compared them however I detected nothing wrong.

RewriteEngine On 
RewriteCond %{HTTP_HOST} ^(www\.)(.+) [OR]
RewriteCond %{HTTPS} off
RewriteCond %{HTTP_HOST} ^(www\.)?(.+)
RewriteRule ^ https://%2%{REQUEST_URI} [R=301,L]

If it does help, domain is bitech.se

share|improve this question

1 Answer 1

Your RewriteCond seems to always match, as the HTTPS version redirects back to the HTTPS over and over.

Try this instead:

RewriteCond %{HTTPS} !=on
share|improve this answer
    
Now it says Moved Permanently. The document has moved here. here refers to "https:///" why??? –  Erfan Mar 9 '13 at 14:54
    
You're trying to redirect to https:/// which doesn't actually contain a hostname. Perhaps you should actually use the hostname, instead of %2. –  Michael Hampton Mar 9 '13 at 14:58
    
Thanks, I did that. However, still no luck. –  Erfan Mar 9 '13 at 15:06

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.