• Resolved LandyVlad

    (@landyvlad)


    I was suddenly getting 404 errors for almost all pages on the website I’m building (homepage excluded).

    I couldn’t figure it out so I asked my host and it turned out not to be hosting related but they identified the following:

    “The issue was because of the below code:
    #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>

    I’ve commented these out and the pages are loading”.

    Obviously I want to get the issue fixed at the source, and have the plugin working. Leaving it commented out is not the solution,

    I’d appreciate guidance in resolving this matter.,

    The page I need help with: [log in to see the link]

Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Support Jarno Vos

    (@jarnovos)

    Hey @landyvlad,

    Is this the full .htaccess file of the affected website, or only the rules from this plugin which you suspected to be related to the problem?

    Because I think the issue you are experiencing is not specifically caused by these rules from our plugin, but rather that the default WordPress .htaccess rules are no longer present in your configuration. WordPress relies on .htaccess rules to handle permalinks. If these rules are missing, WordPress can’t route requests correctly anymore; which will result in 404 errors for all pages except the homepage.

    Usually this can be resolved easily by navigating to Settings -> Permalinks in the left-hand menu in the WordPress Admin Panel, and clicking the “Save” button on the page once (so, don’t make any changes to the Permalinks settings themselves; just click the “Save” button once).

    This will write the default WordPress rules back to your .htaccess file and should fix the issue.

    Kind regards, Jarno

    Thread Starter LandyVlad

    (@landyvlad)

    The below is the htaccess file in my public html directory, as it stands now.

     #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>

    #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
    php_value upload_max_filesize 138M
    php_value post_max_size 138M
    php_value max_execution_time 300
    php_value max_input_time 300

    # BEGIN LiteSpeed
    # The directives (lines) between "BEGIN LiteSpeed" and "END LiteSpeed" are
    # dynamically generated, and should only be modified via WordPress filters.
    # Any changes to the directives between these markers will be overwritten.
    <IfModule Litespeed>
    SetEnv noabort 1
    </IfModule>
    # END LiteSpeed

    # php -- BEGIN cPanel-generated handler, do not edit
    # Set the “ea-php80” package as the default “PHP” programming language.
    <IfModule mime_module>
    AddHandler application/x-httpd-ea-php80 .php .php8 .phtml
    </IfModule>
    # php -- END cPanel-generated handler, do not edit

    as you can see the Really Simple Security code at the top of the file is commented out.

    Plugin Support Jarno Vos

    (@jarnovos)

    Hi @landyvlad,

    What I would do is re-enable the rules from Really Simple Security by uncommenting them, re-save the Permalinks settings as mentioned previously; and check if the issue is resolved by doing so.

    If not, you can always revert to the ‘standard’ WordPress redirect (301 PHP redirect) instead of the .htaccess redirect, since this seems to be what causes the issue for you. Navigate to Security -> Settings -> SSL and set it to 301 PHP redirect instead.

    Kind regards, Jarno

    Thread Starter LandyVlad

    (@landyvlad)

    What I would do is re-enable the rules from Really Simple Security by uncommenting them, re-save the Permalinks settings as mentioned previously; and check if the issue is resolved by doing so.

    Didn’t work.

    If not, you can always revert to the ‘standard’ WordPress redirect (301 PHP redirect) instead of the .htaccess redirect, since this seems to be what causes the issue for you. Navigate to Security -> Settings -> SSL and set it to 301 PHP redirect instead.

    Did work! Thanks Jamo.

    htaccess file now looks like this

    # 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
    php_value upload_max_filesize 138M
    php_value post_max_size 138M
    php_value max_execution_time 300
    php_value max_input_time 300

    # BEGIN LiteSpeed
    # The directives (lines) between "BEGIN LiteSpeed" and "END LiteSpeed" are
    # dynamically generated, and should only be modified via WordPress filters.
    # Any changes to the directives between these markers will be overwritten.
    <IfModule Litespeed>
    SetEnv noabort 1
    </IfModule>
    # END LiteSpeed

    # php -- BEGIN cPanel-generated handler, do not edit
    # Set the “ea-php80” package as the default “PHP” programming language.
    <IfModule mime_module>
    AddHandler application/x-httpd-ea-php80 .php .php8 .phtml
    </IfModule>
    # php -- END cPanel-generated handler, do not edit
Viewing 4 replies - 1 through 4 (of 4 total)

The topic ‘404 errors caused by plugin ‘rewrite’ rules’ is closed to new replies.