Reputation: 312
I'm using .htaccess to force redirection to https://www.domain.com using the following code:
RewriteEngine On
RewriteCond %{HTTPS} !off
# First rewrite to HTTPS:
RewriteRule .* https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
# Now, rewrite any request to the wrong domain to use www.
RewriteCond %{HTTP_HOST} !^www\.
RewriteRule .* https://www.%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
The above result in a page with encrypted output: Is this a problem on my htaccess or, a server problem?
Upvotes: 1
Views: 560
Reputation:
A server problem would be noted with a 5xx error. Check your logs and try this:
RewriteCond %{HTTPS} !on [OR]
RewriteCond "%{HTTP_HOST}" "!^www\." [NC]
RewriteCond "%{HTTP_HOST}" "!^$"
RewriteRule "^/?(.*)" "https://www.%{HTTP_HOST}/$1" [L,R,NE]
Upvotes: 0
Reputation: 26
CloudFlare doesn't use 443 port so, try this:
RewriteCond %{SERVER_PORT} 80
Upvotes: 1