A way to bulk 301 redirect 404’s without ErrorDocument or causing a loop?

[ad_1]

Dealing with a client issue where the client has someone building fake URLs and pushing them into Google via a clever array of junk websites that randomly generate links daily. So far this has created over 4.3 million 404 URLs that appear in Google Search Console and make reports difficult to read.

The client’s server and host do not allow the usage of ErrorDocument directive and offer no other way to handle this at scale. I found a nice little plugin called 404 to 301 which is handling this beautifully but for it to work I had to create a new 404 page inside of WordPress (when I tried using the standard 404.php it went into a loop).

This is technically going to work but it gives off a 200 OK status code and does not give off a 404 error status code, and if it did, it would cause the plugin I am using to loop and crash. Instead I’ve set the page’s meta robots to “noindex” so all of the millions of randomly generated 404 URLs will just point to this one and get noindexed..

This will technically work for now, but I’d prefer to get all of the 404 URLs to 301 redirect to 1 singular 404 URL. Is there any other way of doing this I have not thought of or tried?

Should I just move hosting companies to one that allows ErrorDocument?

[ad_2]
1 Comment
  1. Wait – are the URLs being served FROM your site (meaning it has been hacked), or are you just seeing them in GSC as inbound traffic and/or search queries (meaning that those URLs are being indexed, which they shouldn’t be)? Those are two very different issues. Post screenshots of your GSC.

    I’m not sure why you would want to redirect a 404… seems like a strange thing to do. Also, why would 404 error make it hard to read your GSC reports? They have their own section.

    Regardless, the first thing I’d would do is start blocking where the nefarious URLs are being sent from eg use Cloudflare WAF rules to block countries and ASNs.

 

This site will teach you how to build a WordPress website for beginners. We will cover everything from installing WordPress to adding pages, posts, and images to your site. You will learn how to customize your site with themes and plugins, as well as how to market your site online.

Buy WordPress Transfer