We have Apache serving a set of files from a particular directory. If a file requested in that directory does not exist, can I make Apache return a default file - instead of a 404? If so, how?
+4
A:
This can be achieved making use of .htaccess.
Check this WebReference article on the topic.
Basically you only need a file name .htaccess in your directory which contains
ErrorDocument 404 /YourCustomErrorPage.html
Of course any other file can be served too.
KB22
2009-11-04 15:40:59
+2
A:
What kind of file? Is it a static file? With Apache you can set custom error pages.
Ikke
2009-11-04 15:41:24
+2
A:
Be careful returning non-404s for any random URI request. It may impact your Google rankings if they notice it and consider it part of a link farm or other such blackhat SEO technique.
ceejayoz
2009-11-04 16:04:55
+1 for being interesting and relevant but in my personal experience I've never seen Google slammer my sites for random 404's. Has it happened to anyone?
Frankie
2009-11-04 16:11:21
Article on it: http://gsitecrawler.com/articles/error-404-200.asp
ceejayoz
2009-11-04 16:17:44