When I enable MultiViews, if I visit bad URLs, the my page (index.php) is still reached, when I want the user to get a 404 error instead. I'm trying to figure out how to fix this without creating rules in my .htaccess
.
For example, "www.mydomain.com/index/blah/blah", visits index.php, but I want it to fail due to the extraneous trailing garbage URL components. Similarly for "/contact/blah/awuihda/hiu", which shows the content of contact.php, should give a 404 error, because "/blah/awuihda/hiu" doesn't exist.
If I disable MultiViews it works fine, but then I can't abbreviate the URL as much as I want to (for example, can't type "/contact" to bring up "contact.php").
You could just use the following so the
.php
extension is not required, which is the usual approach:I know it's adding a rule to
.htaccess
but it's a one off that works for everything and also means you're not hitting potential duplicate content allowing the same thing to be served with or without.php
(or indeed with anything at all trailing after it as in your examples). Hope it's useful.It could go in main server config but would need altering.