WordPress on OpenLiteSpeed - able to access website links both via IP (unsecured) and via the domain

36 views Asked by At

I have installed WordPress on OpenLiteSpeed and installed Let's Encrypt for my domain with the option to redirect everything to HTTPS.

My issue is as follows: I am able to access the website's pages, https://example.com/contact/ for example, also via http://SERVER_IP_HERE/contact/

For illlustrative purposes, let's take 161.35.150.160 as my server's IP address.

This shouldn't be possible, right? When someone types http://161.35.150.160/about/ it should automatically redirect to https://example.com/about/ and the same should count for any other path requested.

This always was the case with any of my other wp installations, but for some reason I can't get it to work on this site.

RewriteEngine On
RewriteCond %{HTTP_HOST} ^161.35.150.160$ [OR]
RewriteRule (.*)$ http://example.com/$1 [R=301,L]

I added these lines to my WordPress directory's .htaccess file under, but that didn't do anything. What am I missing or doing wrong?

0

There are 0 answers