[Topic has been merged into this relevant Topic]
I made search on the website and didn’t find the correct code. I’d like to merge those codes but no idea how to perform correctly.
# Rewrite www to non-www RewriteEngine On RewriteBase / RewriteCond %{HTTP_HOST} ^www\.example\.com$ [NC] RewriteRule ^(.*)$ http://example.com/$1 [R=301,L] RewriteRule ^index\.php$ - [L] # WP REWRITE LOOP START RewriteEngine On RewriteBase / RewriteCond %{HTTPS} !=on RewriteCond %{SERVER_PORT} ^80 RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [R,L] RewriteRule ^index\.php$ - [L] Indeed, I want my website been only reachable by https://example.com So I need to redirect all requests from http://example.com http://www.example.com https://www.example.com
And the second part, no idea if it could work… I’m using Polylang to have my website bilingual using two different domains.So, I need for the same website, have the requests from
http://example2.com http://www.example2.com https://www.example2.com to https://example2.com
But as already said, no idea if such a setup will be possible or not…. My first idea would be
# Rewrite everything like a pro RewriteEngine On RewriteBase / RewriteCond %{HTTP_HOST} ^www\.example\.com$ [NC] RewriteRule ^(.*)$ https://example.com/$1 [R=301,L] RewriteRule ^index\.php$ - [L] RewriteCond %{HTTP_HOST} ^www\.example2\.com$ [NC] RewriteRule ^(.*)$ https://example2.com/$1 [R=301,L] RewriteRule ^index\.php$ - [L]RewriteCond %{HTTPS} !=on RewriteCond %{SERVER_PORT} ^80 RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [R,L] RewriteRule ^index\.php$ - [L]
Thanks
Cedric