【问题标题】:mod_rewrite file check with extention带扩展名的 mod_rewrite 文件检查
【发布时间】:2011-12-27 22:51:53
【问题描述】:

这是我的 .htaccess,用于为任何 MVC 架构进行简单的 url 重写。

Options +FollowSymlinks

RewriteEngine On
RewriteBase /personal/site/

RewriteCond $1 !^(index\.php|resources|robots\.txt)
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L,QSA] 

一切正常,只有一个例外出现。在index.php 存在的根目录上,我创建了一个文件generator.js,我也有一个名为generator 的控制器。

所以对于一个请求,http://localhost/personal/site/generator/css

它必须重写为http://localhost/personal/site/index.php/generator/css

但它正在将其重写为http://localhost/personal/site/generator.js/css

如何解决这种情况?

【问题讨论】:

    标签: mod-rewrite apache2


    【解决方案1】:

    关闭多视图。

    Options -MultiViews
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2014-11-08
      • 1970-01-01
      • 1970-01-01
      • 2011-08-19
      • 2018-05-29
      • 2016-09-11
      • 2014-12-10
      • 2011-08-14
      相关资源
      最近更新 更多