Really-Simple-Plugins / really-simple-ssl

Easily improve site security with WordPress Hardening, Two-Factor Authentication (2FA), Login Protection, Vulnerability Detection and SSL certificate generation.
https://really-simple-ssl.com
Other
144 stars 43 forks source link

htaccess breaks permalinks #604

Closed rtpHarry closed 1 year ago

rtpHarry commented 1 year ago

Very strange situation that we have experienced today. The .htaccess has just randomly stopped the pretty permalinks from working.

This is the structure of my .htaccess:

# snip
#Begin Really Simple Security
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteCond %{HTTP:X-Forwarded-Proto} !https
RewriteCond %{REQUEST_URI} !^/\.well-known/acme-challenge/
RewriteRule ^(.*)$ https://%{HTTP_HOST}/$1 [R=301,L]
</IfModule>

Options -Indexes
#End Really Simple Security

# BEGIN WordPress
# The directives (lines) between "BEGIN WordPress" and "END WordPress" are
# dynamically generated, and should only be modified via WordPress filters.
# Any changes to the directives between these markers will be overwritten.
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>

# END WordPress
# snip

And any page under the root, with a pretty permalink, has stopped working.

I moved the WordPress block up to the top and it works, so I moved it down block by block until I found it was the Really Simple SSL block.

Specifically the RewriteRule line (I tried selectively commenting out each of the RewriteCond).

If I move the WordPress block up above the Really Simple Security block then it all goes back to normal.

I dont know if the cache has masked this, or what could have happened, as your last release was 3 weeks ago, and other staff have been working on the pages and only just found this issue.

Really not sure what could have happened but thought I would document it in as much detail as I could in case it is the start of an issue for others.

The site is hosted on litespeed server. Hosting company is guru.co.uk.

rlankhorst commented 1 year ago

Hi @rtpHarry,

Possibly your host has changed the server configuration, causing the redirect rule to be the wrong one all of a sudden.

In this case, I would recommend to remove the redirect block, then enable the .htaccess redirect anew. The plugin will then detect the settings, and insert the correct ones.

Let me know if that helps!