• One of the sites I manage was hacked, probably via a plugin. I updated WP & etc… the original issue is corrected. however, in addition to being hacked, over 5000 backlinks now exist linking to this site. I am concerned about the consequences, SEO-wise.

    I want to make all of the old urls go to 404. I did not have permalinks set up prior to the hack, so all the old urls are /?xyz=zxy style. I’ve now turned on permalinks, so basically, I want ALL the /?xyz style requests to go to 404.

    I’ve tried a number of things with mod_rewrite…

    RewriteEngine On
    RewriteBase /
    RewriteRule ^\? - [R=404,L]

    But the above code does not work. The old links still link to content, they are not redirected to 404.

    Help?

Viewing 1 replies (of 1 total)
  • Thread Starter latitudes

    (@latitudes)

    Someone from stack overflow helped:

    RewriteRule does not work directly on query strings, you have to use RewriteCond to access them (or tricks on internal rewrites, but that’s not necessary here).

    Try

    RewriteCond %{QUERY_STRING} .+
    RewriteRule ^/?$ - [R=404,L]

    Any request to the root path with a query will end in a 404 response.

Viewing 1 replies (of 1 total)
  • The topic ‘site hacked, need to redirect old url's to 404’ is closed to new replies.