这是我的.htaccess简单的URL重写任何MVC架构。
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所在的根目录下,我创build了一个文件generator.js ,我也有一个名为generator的控制器。
所以对于一个请求, http://localhost/personal/site/generator/css ,
它必须重写到http://localhost/personal/site/index.php/generator/css
但它是重写到http://localhost/personal/site/generator.js/css
如何解决这种情况?
我得到了堆栈溢出的解决scheme,解决scheme是多视图的转弯。
Options -MultiViews
这解决了这个问题。