×
新网 > 虚机资讯 > 正文

apache rewrite与options multiviews不得不说的秘密

摘要: apache rewrite与options multiviews不得不说的秘密

OS:ubuntu 14.01

Web Server:Apache/2.4.12

002UASMrzy7605pjKJv15&690.jpg

使用TP框架,伪静态去除index.php

.htaccess内容:

RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ index.php/$1 [QSA,PT,L]

访问地址:http://domain/index/test

apache跳转 404 not found

通过google发现

http://stackoverflow.com/questions/21698245/404-returned-though-rewrite-rule-is-matched

需要在虚拟主机配置文件更改配置,我本机虚拟主机配置已经有Options Multiviews,需要更改

 

Options -Multiviews 查阅相关资料发现

 

Multiviews:

Using a \'MultiViews\' search, where the server does an implicit filename pattern match and chooses from among the results. 英文略渣,以下是翻译结果

 

在服务器做一个隐含的文件名模式匹配和选择的结果。

如果访问地址是http://domain/index/test,而根目录下有index.php,则该地址会被解析为http://domain/index.php/test

在rewrite index/test,apache会寻找目录下是否有index.php文件,如果有就访问此文件,类似如果地址为other/info,则会寻找other.php文件

  • 相关专题

免责声明:本文内容由互联网用户自发贡献自行上传,本网站不拥有所有权,也不承认相关法律责任。如果您发现本社区中有涉嫌抄袭的内容,请发送邮件至:operations@xinnet.com进行举报,并提供相关证据,一经查实,本站将立刻删除涉嫌侵权内容。

免费咨询获取折扣

Loading