I have a LAMP server. When user goes to the url http://mysite.com/helloworld, apache automatically decides to render helloworld.php instead of giving a 404 not found error. I don't see any .htaccess file causing the rewrites. I don't see any rewrite rules in the virtual host files. How do I disable this automatic detection of a .php file and provide 404 error instead?
1 Answer
What you are seeing is the result of content negotiation. If you haven't, make sure that Multiviews is disabled.
- In my case it caused 404 exactly then, when a simmilar file was actually present. So e.g. I requested
/api/restand expected this to be rewriten according to rewriting rules. But I got 404 as long there was a fileapi.phpin main directory! Switching off multiviews helped. Thx.Artur Cichosz– Artur Cichosz2014-10-15 08:52:53 +00:00Commented Oct 15, 2014 at 8:52