码迷,mamicode.com
首页 > Web开发 > 详细

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

时间:2015-06-09 14:16:03      阅读:1207      评论:0      收藏:0      [点我收藏+]

标签:

OS:ubuntu 14.01

Web Server: Apache/2.4.12

使用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文件

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

标签:

原文地址:http://my.oschina.net/jhasheng/blog/464524

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!