I’m having issues with my domain pointing to my Wordpress Openlite Server. All except https://example.org is not pointing to my https://www.example.org site (all http points to the correct secure domain.

I know that this has been asked a lot and tried most of the suggestions including overwriting my .htaccess. I even used Redirect plugin but with no avail.

The latest code I used for the htcaccess is this:

RewriteEngine on
RewriteCond %{HTTPS} !on [OR]
RewriteCond %{HTTP_HOST} !^www\.
RewriteRule (.*) https://www.example.com%{REQUEST_URI} [L,R=301]

It still wont redirect the correct one and this also causes issues on my other pages not redirecting the correct url. I also saw this:

RewriteCond %{HTTP_HOST} ^www\.your-domain\.com
RewriteRule (.*) https://your-domain.com/$1 [R=301,L]

But based on the rewrite Cond, it could only accommodate HTTP and not HTTPS.

Any help is much appreciated.

Thanks

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

×
1 answer

Hello, @jonasalmocera

The .htaccess rules can sometimes be trickier and you can spend hours in order to find the one that is suitable with your needs. If you want to forward all the traffic to the www version of your domain name can you please try with using this code:

RewriteEngine On
RewriteCond %{HTTP:X-Forwarded-Proto} !https
RewriteRule ^(.*)$ https://www.yourdomain.com/$1 [R=301,L]

An alternative one will be:

RewriteEngine On
RewriteCond %{HTTPS} !on
RewriteRule ^(.*)$ https://www.yourdomain.com/$1 [R=301,L]

Hope this helps!

Let me know how it goes.

Regards,
Alex

Submit an Answer