1

I wish to forward all visitors to my site to use HTTPS instead of HTTP. Whatever they request, I want to server over HTTPS.

I've tried adding this to my .htaccess file:

RewriteEngine On RewriteCond %{HTTPS} off RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} 

But it just causes a redirect loop. I'm guessing RewriteCond isn't functioning as expected?

1 Answer 1

2

This should work :

RewriteEngine On RewriteCond %{HTTPS} !on RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [NE,NC,R,L] 
Sign up to request clarification or add additional context in comments.

1 Comment

Indeed it does. Thanks!

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.