I had a site which became a victim of some spam hacks. This is all resolved, I am now just trying to set a 410 status for these pages which are part of Google's index. They 404 right now but I want them gone as quick as can be. Thankfully they all used .html and I have no other .html pages in my directory.
How can I use .htaccess to set a 410 to fit the below pattern?
http://domain.com/AnyFileName.html
This should not target anything in a subdirectory, so the below would be ignored:
http://domain.com/folder/AnyFileName.html
Below is what I have tried, but it's still returning a 404.
<IfModule mod_rewrite.c>
RewriteRule \.html$ - [G]
</IfModule>
You can use:
[^/.]+
will make sure to match these html files only in site root leaving html files in sub directories untouched.