WordPress fubar

What happened…

So… I had a adsense account suspended… In panic i started deleting posts, tags and doing expanded searches for any clothing sizes “xxxl” or any other terms that could be offensive…

I resubmitted for reactivation and was denied. So i deleted more product pages, tags and such that are valid product names but apparently are sex related slang. Such as the shoe brand “Footjoy” which from my understanding is slang among some for some sort of perversion.

Then there was a HUGE influx of other people posting similar problems and reporting being suspended unsure of what they have done wrong.

Ended up the site had been hacked by what is referred to as a conditional hack. Basically the text and link was not viewable by a browser but when visited by a google bot the link to the porn sites was inserted. For me it was in the copyright statement and the function calling “year” was swapped out with a long line of porn links.

So i removed the function from the footer in wordpress and adsense has been restored… Unfortunately even after cleaning up i was looking at over 2500+ broken links.

I have been doing what i can cleaning up all wordpress sites affected but my ranking will never be what it was… I still have dead links listed online that are no longer dead but for some reason they still show in the Google webmaster tools report. I tried to used a plugin absolute links but it only ended up in creating redirect loops.

From experienced users that have had this type of situation with thousands of broken links at one time…

Is it better to just redirect all 404 errors to the index page that cant be restored?

Is there any standard procedure for a situation like this to help recover link juice or is all lost?

Any and all suggestions are welcome…

404 errors should not be redirected to the index page, ever. Just leave them as 404. You can put a link to the index page on your 404 page, but don’t do the redirect by any automatic method.

If any of the pages that are now returning 404 have offensive names (that is, pages inserted by the hack that weren’t your originally named pages), you can use .htaccess to return a 410 Gone response for them instead of 404. The 410 tells search engines to deindex the page immediately and not come looking for it again.

Sorry I don’t have a solution for 2500 broken links, unless you have a backup of your site and its database from before the hack.

the last backup i had was infected… :frowning:

So in wordpress what is the best way to setup about 1,100 410 status? :slight_smile:

I just keep finding wordpress plugins that do a 301 redirect to the site root.

If you can identify the bad requests because there are offensive words in the URLs or the querystrings, you can put code in your top level .htaccess that will report the URLs as Gone even before the request reaches WordPress.

Here is some template code for doing that, but you must NOT just drop this code into your .htaccess. You will need to understand exactly what it does and customize it for your purposes. This is just an example. If any of the bad words appears in the base URL or in the query string, the associated page will get a 410 response.

If you can’t identify the requests by there being offensive words in the URI or query string, this code won’t help at all.

Example of bad word in URI:

hxxp://yoursite.com/buy-cheap-badword-online.html

Example of bad word in query string:

hxxp://yoursite.com/index.php?topic=badword

The list of words for the URI and query string don’t have to be the same.

RewriteEngine On
RewriteCond %{REQUEST_URI} (badword1|badword2|badword3) [NC,OR]
RewriteCond %{QUERY_STRING} (badword1|badword2|badword3) [NC]
RewriteRule .* - [G,L]

I just keep finding wordpress plugins that do a 301 redirect to the site root.
I haven’t used WordPress. I think some applications redirect 404’s to the site root by default. Don’t know if that’s true of WP. If it is, there may not be much you can do about it unless you dig into the code or try to modify WP’s default .htaccess, which would carry the risk that you might mess things up.

On the broken link problem, were those created by your tearing out products, etc., before you knew what the problem was?

If so, you could start with your infected backup copy, and this time just clean the parts that actually need it. Yes, you’d be doing the cleanup a second time, but this time you could do a better job of it, without all the unnecesary damage.