Is it possible to simplfy these RewriteRules? I've hundreds of similar entries in my .htaccess
file and it seems not to be the best way to set a 410 Header.
RewriteRule ^pageID_9363511.html - [G]
RewriteRule ^pageID_9363511_2.html - [G]
RewriteRule ^ci_8819019/thumb_11725326.JPG - [G]
…
…
Thank you
You could use a rewrite map like this:
pageID_9363511.html -
pageID_9363511_2.html -
ci_8819019/thumb_11725326.JPG -
Then you lookup the requested URI path like this:
RewriteCond ${gone:$0} =-
RewriteRule .+ - [G]
The only simplification is that you don’t need the repetitive RewriteRule
and [G]
. And with a rewrite map of the type dbm you could even have an access time of O(1) instead of O(n).