How can I redirect everything but the index as 410?

Posted by Mikko Saari on Pro Webmasters See other posts from Pro Webmasters or by Mikko Saari
Published on 2011-03-15T11:47:03Z Indexed on 2011/03/15 16:19 UTC
Read the original article Hit count: 264

Filed under:
|
|
|

Our site shut down and we need to give a 410 redirect to the users. We have a small one-page replacement site set up in the same domain and a custom 410 error page. We'd like to have it so that all page views are responded with 410 and redirected to the error page, except for the front page, which should point to the new index.html.

Here's what in the .htaccess:

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

This works, except for one thing: If I type the domain name, I get the 410 page.

With www.example.com/index.html I see the index page as I should, but just www.example.com gets 410. How could I fix this?

© Pro Webmasters or respective owner

Related posts about apache

Related posts about htaccess