• I have searched extensively and found many ways to get rid of 404 errors, but no way to create them.

    I was hacked a few months ago, and a large number of pages with BS addresses like https://www.insightlaw.ca/?p1264897 were created and indexed by google. There’s some other formats, too, but they all come down to garbage query strings. After cleaning up the hack, they now all load the home page, which I believe is normal wordpress behaviour, since my other wordpress sites do the same thing.

    Unfortunately, because they’ve been indexed by google, this isn’t good enough. I need a 404 error so that google removes them. Searching site:insightlaw.ca now gives me 133 results (only the home page is currently used), most of which are home page duplicates, and a few still have hacked content cached.

    I’ve been able to achieve this by commenting out the following line in .htaccess.

    RewriteRule . /index.php [L]

    This provides a messy workaround, since now permalinks that should work are also broken. Not presently a problem, but we’re wanting to add some blog-style content in the near future, and need them to work.

    Is there a way to get a 404 error thrown for garbage query strings, without also breaking correct permalinks? It works for actual filenames like “/fred.php”, but that’s not sufficient.

    Version: 4.6
    Theme: Square v1.2.7
    Plugins:
    – Facebook Thumb Fixer v1.6
    – Google Analytics Counter Tracker v3.3.0
    – Graceful Email Obfuscation v0.2.2
    – Verify Google Webmaster Toos v1.3
    – Wordfence Security v6.1.14

  • The topic ‘Can't get WP to throw a 404 error when a appropriate’ is closed to new replies.