Reputation: 11
I want to return 410 errors from my whole website pages so how to do this in just a few lines of code. I have used this syntax Redirect 410 [page-path] in .htaccess file but it is just to block one page what if I want for the whole website?
In doing so I think I have type this syntax 100 times. So is there any code that can help me to return 410 errors for the whole website.
Upvotes: 1
Views: 1141
Reputation: 25524
You can use a pattern to match any URL on your site. Such a pattern is the regular expression .*
. .
means "any character" and *
means "zero or more of them", so .*
means "anything or nothing."
There are at least two different apache modules that can do this for you. You can usually choose to use either of them. The code would work either in your virtual host conf file or in a .htaccess file.
mod_alias
:RedirectMatch gone .*
mod_rewrite
:RewriteEngine on
RewriteRule .* - [G]
Upvotes: 0