Here is my configuration regarding redirections:
1/ There are several OVH redirections thanks to their admin tool:
lemagcinema.fr and https://www.lemagcinema.fr are redirected to an IP adress which is supposed to access both the wordpress site and the OVH CDN
lemagcinema.com and https://www.lemagcinema.com are redirected to the same IP adress
2/ my wordpress installation is under www/wp not www directly (but wp is not used thanks to wordpress configuration)
3/ polylang is supposed to perform redirections in a way I don’t know
4/ under the www directory, I have a main .htaccess file,
there are several redirections a, b and c in this order in the file:
a/ at the beginning of the file, I used custom instructions to add https redirection:
# Redirection vers HTTPS
RewriteCond %{HTTP_HOST} ^lemagcinema.fr [NC]
RewriteCond %{REQUEST_URI} !_index.
RewriteCond %{SERVER_PORT} ^80$ [OR]
RewriteCond %{HTTPS} =off
RewriteRule ^(.*)$ https://lemagcinema.fr/$1 [R=301,L]
RewriteCond %{HTTP_HOST} ^www\.lemagcinema.fr [NC]
RewriteCond %{SERVER_PORT} ^80$ [OR]
RewriteCond %{HTTPS} =off
RewriteRule ^(.*)$ https://lemagcinema.fr/$1 [R=301,L]
RewriteCond %{HTTP_HOST} ^lemagcinema\.com [NC]
RewriteCond %{SERVER_PORT} ^80$ [OR]
RewriteCond %{HTTPS} =off
RewriteRule ^(.*)$ https://lemagcinema.com/$1 [R=301,L]
RewriteCond %{HTTP_HOST} ^www\.lemagcinema\.com [NC]
RewriteCond %{SERVER_PORT} ^80$ [OR]
RewriteCond %{HTTPS} =off
RewriteRule ^(.*)$ https://lemagcinema.com/$1 [R=301,L]
b/ W3TC performs adds its own redirection:
# BEGIN W3TC Page Cache core
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteCond %{HTTPS} =on
RewriteRule .* – [E=W3TC_SSL:_ssl]
…
# END W3TC Page Cache core
c/ wordpress adds its own redirections
5/ because my domain also has a forum which is available on lemagcinema.fr/forum I also had to add some redirections in an .htaccess file under /www/forum
At the end of the file, I added:
# Redirection vers HTTPS
RewriteCond %{SERVER_PORT} ^80$ [OR]
RewriteCond %{HTTPS} =off
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [R=301,L]
(this configuration works – except the present issue on lemagcinema.com – but I did not understand why I had to also add these lines, because those in the root .htaccess file could have been enough I thought)
I hope the W3TotalCache and polylang dev teams read this forum …