阿帕奇忽略文件扩展名 [英] Apache ignoring file extensions

查看:104
本文介绍了阿帕奇忽略文件扩展名的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我用下面的.htaccess code,使我的网址清洁:

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]

有基本上检查是否所请求的URL指向一个文件或目录,如果没有,它格式化它以特定方式。

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.

现在的问题是,我的生产服务器似乎忽略文件扩展名时,它会检查请求的URL指向文件。例如,它会考虑网址 /联系人指向一个名为 contact.jpg 如果与该名称的文件存在于服务器的根目录。

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.

是什么导致Apache作用一样,我能做些什么来控制它 - 让严格的有关文件扩展名

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

推荐答案

我相信这是因为MultiViews选项。 尝试选项-MultiViews 中的.htaccess

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

这篇关于阿帕奇忽略文件扩展名的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆