我正在托管一个使用zend框架制作的应用程序。我在公共文件夹上有一个.htaccess文件,用来重定向所有通过index.php的请求。它正在工作,但我在应用程序中没有获得请求参数。为什么会这样呢?
RewriteEngine on
Options +FollowSymlinks
RewriteBase /
RewriteRule !\.(js|ico|txt|gif|GIF|jpg|png|PNG|css|xml|JPG)$
index.php
发布于 2011-04-07 04:58:18
这不是一个非常健壮的解决方案。当请求未包含在列表中的文件扩展名时,会发生什么情况?
标准ZF 1.11规则要好得多
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} -s [OR]
RewriteCond %{REQUEST_FILENAME} -l [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^.*$ - [NC,L]
RewriteRule ^.*$ index.php [NC,L]
发布于 2011-04-07 05:00:00
这会将除列出的文件类型之外的所有请求传递到index.php
RewriteCond %{REQUEST_FILENAME} !\.(js|ico|txt|gif|GIF|jpg|png|PNG|css|xml|JPG)$
RewriteRule (.*)$ http://domain.com/index.php$1 [R=301,L]
https://stackoverflow.com/questions/5576104
复制相似问题