Paul Paul - 3 months ago 36
PHP Question

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


Try this in your root .htaccess:

ErrorDocument 410 /error-410.php

RewriteEngine on

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