1

I want to 410 all urls with .html extension.

say xx.html, yy.html (all with .html).

How do I acheive that with htacess Rewrite or redirect 410 rules?

Helen M
  • 11
  • 4

3 Answers3

1

HTTP status 410 means "Gone", which can be accomplished by the [G] flag in mod_rewrite.

RewriteRule \.html$ - [G]

See documentation for the G flag and the documentation for mod_rewrite.

Sumurai8
  • 20,333
  • 11
  • 66
  • 100
  • Not sure. Getting 500 error. I am using could you give me the complete code? – Helen M Jul 24 '13 at 06:52
  • @HelenM since you mention .htaccess I assume some sort of Apache server. In which case, you should check the _error_ log while trying to solve this problem. –  May 16 '17 at 18:01
0

Use this in your .htaccess file.

RewriteEngine On
RewriteRule \.html$ - [G]
0

Just add this single line to your .htaccess file

RedirectMatch gone "/*\.html$"

Done, this is auto http header status to 410

Hans Ganteng
  • 179
  • 1
  • 4