Redirecting 10,000 Broken Links

I recently acquired an old search engine domain that I’m now using for a blog. The name is great, but unfortunately, nearly 10,000 (and counting) broken links for various searches are left behind. I can’t seem to find a solution for redirecting only the broken links.

  1. ErrorDocument 404 / doesn’t work. Maybe it’s conflicting with my Wordpress .htaccess?
  2. None of the plug-ins for 301 redirection in Wordpress handle mass redirects.

How can I redirect only the broken links on my site? Any help is greatly appreciated. I’m quite frustrated right now.

I don’t think I understand where you are trying to redirect them too. But you have the option to do a blanket redirect of the entire domain to the new domains home page.


You’ve replaced a search engine with a WordPress website?

My first reaction was to give up as WP will “take over” any 404 and redirect to its file handler (index.php). Then, the required “spark” suggested that the search engine used either (likely both) a search page such as search.php (hopefully not the same index.php that WP uses) AND/OR a query string that would have a specific key that you could use as a marker (to avoid the capture by WP). If either of these are the case, please advise and I can help you though the mod_rewrite code.

PT also has a good point: What do you want to do with the search engine’s 404’s?



Thanks for the help! I actually just want to redirect them to the homepage. Wordpress seems to be catching these not-founds on its own and sending them to a custom 404 page.

I’d like to set up code to redirect any page that does not exist to my homepage. So if you end up at /search.aspx?cute-kittens or /search.aspx?any-random-string, I’d like the visitor to be redirected to the homepage.


What you’re suggesting will disable WP’s ability to use strings in your request which allow it to link to entries in its article database. Since mod_rewrite doesn’t have the power to look into the database (unless you have SysAdmin privileges), you’ll have to modify the WP code for 404 handling. You inferred that there is “a custom 404 page” so you could use that to simply redirect to the “clean” index.php (“homepage”) script.

If the last sentence needs clarification, find the 404 handler and add code to redirect to index.php WITHOUT adding a query string. If you can put it in the 404 handler’s <head> section, a <meta> redirection would be optimal otherwise PHP or JavaScript code to change the location() would be necessary.