I have cleaned up my site and discarded lots of pages. I have now 10pages left of a 100page site, all static html. I want any request for deleted pages to 301 redirect to homepage but can't figure out the .htaccess rules!
+1
A:
I doubt there's a better way than listing out the 90 pages manually in your .htaccess
:
redirect 301 /somedeletedpage.htm http://www.example.com/
unless the 90 removed pages have some common characteristics that can be regexed.
Dominic Rodger
2009-10-26 14:18:26
Will it be better to check if the requested page exists, then serve it, if nonexistent then redirect to homepage?
Tutul
2009-10-26 15:46:11
@Tutul - no, since that might prevent 404s for pages that never have existed.
Dominic Rodger
2009-10-26 15:49:40
+1
A:
you don't want to 301 it, that would be an incorrect code, as those missing pages have not been moved to the location of your main page. You should be serving a 404 or a 410. You could use a custom 404 so your users could have some links to the pages that are there now.
jatar_k
2009-10-26 14:22:28
@Tutul - no, if anything it'll be better for search engine rankings, especially 410 - since that is the correct response (the content has *gone*).
Dominic Rodger
2009-10-26 15:50:17
as Dominic said, this is better, 301 everything to your main page could be an seo nightmare, though reducing from 100 to 10 is a bit odd as well but that is outside the scope of this question.
jatar_k
2009-10-26 16:36:54