RewriteCond(htaccess)用于排除Zend框架处理的URL

时间:2015-02-14 05:37:02

标签: mod-rewrite zend-framework

以下是mod_rewrite申请的Zend个配置(请参阅Rewrite Configuration Guide)。

<IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteCond %{REQUEST_FILENAME} -s [OR]
    RewriteCond %{REQUEST_FILENAME} -l [OR]
    RewriteCond %{REQUEST_FILENAME} -d

    RewriteRule ^.*$ - [NC,L]
    RewriteRule ^.*$ index.php [NC,L]
</IfModule>

我已安装mod_status,并希望排除/server-status处理Zend Controller Dispathcer的{​​{1}}个网址。 我尝试过以下RewriteCond,但它们都不起作用:

RewriteCond %{REQUEST_URI} !=/server-status  [NC]
RewriteCond %{REQUEST_URI} !^/server-status* [NC]
RewriteCond %{REQUEST_URI}  !(server-status) [NC]

我得到以下例外:

'ERROR CODE: 54dedae933247 - Page not found: exception \'Zend_Controller_Dispatcher_Exception\' with message \'Invalid controller specified (server-status)\' in /usr/share/php/project/libraries/library/Zend/Controller/Dispatcher/Standard.php:248
Stack trace:
#0 /usr/share/php/project/libraries/library/Zend/Controller/Front.php(954): Zend_Controller_Dispatcher_Standard->dispatch(Object(Zend_Controller_Request_Http), Object(Zend_Controller_Response_Http))
#1 /var/www/myapp/application/My_Bootstrap.php(255): Zend_Controller_Front->dispatch()
#2 /usr/share/php/project/libraries/library/Zend/Application.php(366): My_Bootstrap->run()
#3 /var/www/myapp/public/index.php(43): Zend_Application->run()
#4 {main}'

我想我可以通过扩展Zend_Controller_Action并在preDispatch中排除此网址,排除此网址,但我不想这样做,因为我必须更改代码,而对于其他相同的情况我必须更改代码(脏解决方案),有时我无法访问代码。

我必须包含哪些条件才能排除/server-status

0 个答案:

没有答案