I have had this problem on two very different grades of Apache servers now (cheap, shared stuff and a high-end, expensive, HIPAA-compliant box), so I thought I’d post something reasonably search-friendly in case someone else was looking for the answer.
If you are trying to use mod_rewrite the way a normal human would, to rewrite things like
host/page.php?slug=slug-for-page, and you have “MultiViews” turned on in Apache, they will not work. Here’s what that setting does, straight from the documentation:
If the server receives a request for /some/dir/foo and /some/dir/foo does not exist, then the server reads the directory looking for all files named foo.*, and effectively fakes up a type map which names all those files, assigning them the same media types and content-encodings it would have if the client had asked for one of them by name. It then chooses the best match to the client’s requirements, and returns that document.
That means the server is effectively guessing what file you’d want them to see if the one they ask for doesn’t exist, which sounds like something I (and damn near everyone else) would 100% never want to happen. I’m not sure why it seems to defaulted on (or alternatively, why so many hosts turn it on themselves). If a page is missing, I want a 404. I want it logged, and I want to know. Period.
If you are like me and would like this to never happen, you can turn it off via Apache config if you have access to that, or you can turn it off in .htaccess using