问题
now I have a website https.
http://www.example.com -> https://www.example.com = OK !
But, I have a problem with www ://example.com -> s://example.com = not good
I would like to have this redirection below : ://example.com -> s://www.example.com
How with RewriteCond and RewriteRule ? Help me plz !
Thanks !
回答1:
To enforce https on all requests and redirect to www.example.com
# force https and www
RewriteCond %{HTTPS} off
RewriteRule ^ https://www.example.com%{REQUEST_URI} [R,L]
# if already https without www
RewriteCond %{HTTPS} on
RewriteCond %{HTTP_HOST} ^example.com$
RewriteRule ^ https://www.example.com%{REQUEST_URI} [R,L]
来源:https://stackoverflow.com/questions/37646915/rewrite-https-and-www