- one redirect from port 80 to port 443 (from plain HTTP to HTTPS);
- one redirect from https://www.yoursite.com to https://yoursite.com without sacrificing the HTTPS aspect;
So here is the snippet.
# Redirect http to https
RewriteCond %{SERVER_PORT} 80
RewriteRule (.*) https://yoursite.com/$1 [R=301,L]
# Redirect www to non-www/https
RewriteCond %{HTTP_HOST} ^www\.yoursite\.com
RewriteRule (.*) https://yoursite.com/$1 [R=301,L]
Niciun comentariu:
Trimiteți un comentariu