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?
相关问题
- Stop .htaccess redirect with query string
- .htaccess rule, redirecting old unexistent address
- How to deploy a web application Aurelia in an Apac
- Apache Directory Studio not opening
- PHP Empty $_POST
相关文章
- Apache+Tomcat+JK实现的集群,如果Apache挂了,是不是整个服务就挂了?
- How reliable is HTTP_HOST?
- Making a two way SSL authentication between apache
- UnicodeEncodeError when saving ImageField containi
- mod_rewrite only on GET
- Zurb Foundation 5, modernizr not found
- jquery how to get the status message returned by a
- How do I debug errors that have no error message?
What kind of file? Is it a static file? With Apache you can set custom error pages.
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.
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
Of course any other file can be served too.