dimanche 4 juin 2017

Apache: Redirect all requests to https://www.domain.tld

I can not find a working solution for me.

Here my settings:

# Redirect non-www to www
RewriteCond %{HTTP_HOST} !^www\.
RewriteRule ^(.*)$ http://www.%{HTTP_HOST}/$1 [R=301,L]

# Redirect http to https
RewriteCond %{HTTP:X-Forwarded-Proto} !https
RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]

The each parts work very well but not together. The part for https redirection always redirect to https://domain.tld so without www, It is ignored. Does someone know a solution?

Thanks in advance.




Aucun commentaire:

Enregistrer un commentaire