Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

My httpd.conf uses the MultiViews option to serve HTML files for URLs like http://server/blog. This works fine, unless there are directories with the same name – Apache will then try to serve the directory.

Is there any way to ensure precedence of blog.html over blog/, or rather: can I make Apache process content negotiation according to MultiView although a matching entity (the directory) is present?

In nginx, I can do this explicitly:

try_files $uri $uri.html $uri/ =404;
share|improve this question
add comment

1 Answer

up vote 2 down vote accepted

I retreated to using mod_rewrite. The following rule rewrites URLs without a dot (".") only, so /images/image.jpeg is left alone:

RewriteRule ^/([^\.]+)$ /$1.html [L]
share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.