Paul
Paul

Reputation: 385

htaccess redirect everything to 410

I am trying to force all requested urls from a domain to a custom 410 error page. I am using the following rule, but it does not catch everything. I need it to catch all folders, .html, .php and jpgs etc...

RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule !^index\.html$ index.html [L,R=410]

ErrorDocument 410 /error-410.php

Can anyone help? Cheers

Upvotes: 2

Views: 3295

Answers (1)

anubhava
anubhava

Reputation: 786291

Try this in your root .htaccess:

ErrorDocument 410 /error-410.php

RewriteEngine on

RewriteCond %{ENV:REDIRECT_STATUS} ^$
RewriteCond %{HTTP_HOST} ^(www\.)?sub\.domain\.com$ [NC]
RewriteRule ^ - [L,R=410]

Upvotes: 3

Related Questions