I would like that all these addresses:
http://www.example.com
(currently correctly redirecting with my .htaccess file)http://example.com
(currently correctly redirecting with my .htaccess file)https://www.example.com
(this address does not redirect)
redirect to https://example.com
.
With the following .htaccess
file, I can only get the 1. and 2. addresses redirect to https://example.com
.
Only https://www.example.com
is still not redirecting to https://example.com
.
Here is my .htaccess
file
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
# URL with www rewrite to https without www
RewriteCond %{HTTP_HOST} ^(www\.)(.*) [NC]
RewriteRule (.*) https://%2%{REQUEST_URI} [L,R=301]
# URL without www rewrite to https
RewriteCond %{HTTPS} off
RewriteCond %{HTTP_HOST} !^(www\.)(.*) [NC]
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
# END WordPress