.htaccess - How do i set a 410 status for any page with a .html file extension? -


i had site became victim of spam hacks. resolved, trying set 410 status these pages part of google's index. 404 right want them gone quick can be. thankfully used .html , have no other .html pages in directory.

how can use .htaccess set 410 fit below pattern?

http://domain.com/anyfilename.html

this should not target in subdirectory, below ignored:

http://domain.com/folder/anyfilename.html

below have tried, it's still returning 404.

<ifmodule mod_rewrite.c>     rewriterule \.html$ - [g] </ifmodule> 

you can use:

rewriteengine on  rewriterule ^[^/.]+\.html$ - [g,nc,l] 

[^/.]+ make sure match these html files in site root leaving html files in sub directories untouched.


Comments

Popular posts from this blog

PHP DOM loadHTML() method unusual warning -

python - How to create jsonb index using GIN on SQLAlchemy? -

c# - TransactionScope not rolling back although no complete() is called -