Apache ignoring file extensions

ぃ、小莉子 提交于 2020-01-04 04:13:05

问题


I use the following .htaccess code to make my URLs cleaner:

RewriteEngine on
RewriteBase /

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?$1 [L]

It basically check if the requested URL points to a file or a directory and if it doesn't, it formats it in a particular way.

The problem is that my production server seems to ignore file extensions when it checks if the requested URL points to a file. For example, it would consider the URL /contact pointing to a file named contact.jpg if a file with that name existed on the root of the server.

What causes Apache to behave like that and what can I do to control it - make it strict about file extensions?


回答1:


I believe it's because of MultiViews option. Try Options -MultiViews in the .htaccess



来源:https://stackoverflow.com/questions/5692178/apache-ignoring-file-extensions

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!