I have recently been the victim of this hacking exploit (blog post is for reference only and is not my site. I'm in the process of following it and cleaning up after the attack).

Note the exploit at the top of my .htaccess file;

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteRule myq-(.*).htm$ wp-includes/js/tinymce/themes/advanced/skins/wp_theme/img/style.css.php [L]

Options +FollowSymLinks
IndexIgnore .htaccess */.??* *~ *# */HEADER* */README* */_vti*

<Limit GET POST>
order deny,allow
deny from all
allow from all

order deny,allow
deny from all

<IfModule mod_rewrite.c>

# BEGIN WordPress
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
# END WordPress

So the exploit has had the effect of producing hundreds of spam links in Google, but under my domain name. Some examples;


Printable coloring pages of a caterpillar mysite.com

Coloured lettering cut out mysite.com

Printable leopard coloring page mysite.com

Printable oedipus rex mysite.com


What is the most effective way to combat these links by using Google Webmaster Tools and .htaccess to get rid of them from the Google results.

Is it best to serve a 404? How can I achieve this using the .htaccess file?

The site is hosted is on a shared server. I only have access to a limited cPanel and FTP for any form of site configuration.

Any pointers appreciated. Thanks in advance.


Serve a 404 error. That will tell Google and other search engines to remove those pages from their index. Deleting the files themselves will all be you need to do. No need to do anything with .htaccess or otherwise.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.