It's been asked a gazillion times but it's still not working in my Wordpress. I want to redirect everything to https://website.com. Current code been used:
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteCond %{HTTPS} off [OR]
RewriteCond %{HTTP_HOST} ^www\. [NC]
RewriteCond %{HTTP_HOST} ^(?:www\.)?(.+)$ [NC]
RewriteRule ^ https://%1%{REQUEST_URI} [L,NE,R=301]
</IfModule>
based on this one but I also tried all in this page and of course this other one. Maybe I am missing something but this is what happens no matter what combination I tried:
# http://website.com -> https://website.com
# https://website.com -> https://website.com
# http://www.website.com -> https://www.website.com #wrong#
# https://www.website.com -> https://www.website.com #wrong#
I am starting to wonder whether the let's encrypt installation has something to do... or even some other modification done in wp-config.php... I added this in the past:
if ( defined( 'WP_CLI' ) ) {
$_SERVER['HTTP_HOST'] = 'localhost';
}
define('WP_SITEURL', 'https://' . $_SERVER['HTTP_HOST'] . '/');
define('WP_HOME', 'https://' . $_SERVER['HTTP_HOST'] . '/');
Any idea? Thanks
.htaccess
file in relation to the WordPress front-controller?