• Resolved Irene

    (@arlinaite)


    When somebody tries to access a non-existent page from the main site it redirects to the home page of the subsite.
    Example:
    example.com/nonexistent-page
    redirects to
    example.com/es

    I had a redirect for a while in the 404 page of example.com :
    <?php wp_redirect( '//surdelsur.com/es/', 301 ); exit; ?>
    Then I realized that was a very bad idea and I deleted the code

    However wordpress repeats the behaviour.
    How can I go back to normal
    example.com/nonexistent-page => 404.php

    Thanks in advance

    • This topic was modified 3 years ago by Irene.
Viewing 4 replies - 1 through 4 (of 4 total)
  • yasu88

    (@yasu88)

    Hello,

    If you’ve removed the rewrite rule from the .htaccess and if you don’t have any other custom error page like a plugin.

    I can only imagine you may have some directives to the apache or nginx.

    But first try the following: Check if you’ve any rewrite rule on the .htaccess or you may try disabling the .htaccess “You can rename”

    Default: https://wordpress.org/support/article/htaccess/

    Disable all the plugin and open the website “Make sure to use a private window”

    Thread Starter Irene

    (@arlinaite)

    I asked Cloudways support, they say they dont have redirections at server level.

    To be sure about htaccess file I have done the following test:

    In my stage site I have deleted all the redirects of the htaccess file, and all extra code from plugins, I left only the wp code. Obviously I deactivate W3TC and the stage site is not cached by the Cloudflare CDN or any other. I use a cache killer extension in chrome and I tried with Edge too.

    Then I checked, for example:
    https://example-stage-site/nonexistent-page
    and redirects to
    https://example-stage-site/es/`

    Thread Starter Irene

    (@arlinaite)

    I checked the redirect with https://redirect.li/ and I found:
    That is x_redirect_by WordPress.

    I add in code snippet plugin

    add_filter( 'x_redirect_by', '__return_false' );

    But it doesn’t work.

    Thread Starter Irene

    (@arlinaite)

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Unwanted 404 redirect to home page’ is closed to new replies.