How can I redirect all www requests to non-www with https?
For example all following 3 URL`s:
http://www.example.com/about-us
http://example.com/about-us
https://www.example.com/about-us
Should redirect to https://example.com/about-us
I have tried answers posted at
redirection issue in www to non www with ssl/https
and
.htaccess redirect www to non-www with SSL/HTTPS
but they are not working. My current rule is
RewriteEngine On
RewriteCond %{SERVER_PORT} !=443 [OR]
RewriteCond %{HTTP_HOST} !^example\.com$ [NC]
RewriteRule ^ https://example.com%{REQUEST_URI} [R=301,L]
Please guide.