重写规则不适用于.htaccess但使用vhost

时间:2014-08-01 14:51:50

标签: apache .htaccess mod-rewrite virtualhost

我对这一点感到有点恼火,我很确定这些规则是正确的,但在.htaccess文件中使用它们时,它们就不适用​​了。

规则通过dispatch.php推送所有内容,然后dispatch.php为我处理我的MVC视图和控制器。

 //htaccess file - Accessing http://topaz.local/app/users/login
RewriteEngine On

RewriteCond %{REQUEST_URI} !dispatch/.php$
RewriteCond /var/www/topaz%{REQUEST_FILENAME} !-f
RewriteRule ^(/.*)$ /dispatch.php?url=$1 [L,QSA]
RewriteRule ^x/.!dispatch/.php([^b]+)!dispatch/.php$ !dispatch/.php [L,NE]
[topaz.local/sid#12a94f8][rid#1ee71b0/initial] [perdir C:/var/www/topaz/] add path info postfix: C:/var/www/topaz/app/users -> C:/var/www/topaz/app/users/login
[topaz.local/sid#12a94f8][rid#1ee71b0/initial] [perdir C:/var/www/topaz/] strip per-dir prefix: C:/var/www/topaz/app/users/login -> app/users/login
[topaz.local/sid#12a94f8][rid#1ee71b0/initial] [perdir C:/var/www/topaz/] applying pattern '^(/.*)$' to uri 'app/users/login'
[topaz.local/sid#12a94f8][rid#1ee71b0/initial] [perdir C:/var/www/topaz/] add path info postfix: C:/var/www/topaz/app/users -> C:/var/www/topaz/app/users/login
[topaz.local/sid#12a94f8][rid#1ee71b0/initial] [perdir C:/var/www/topaz/] strip per-dir prefix: C:/var/www/topaz/app/users/login -> app/users/login
[topaz.local/sid#12a94f8][rid#1ee71b0/initial] [perdir C:/var/www/topaz/] applying pattern '^x/.!dispatch/.php([^b]+)!dispatch/.php$' to uri 'app/users/login'
[topaz.local/sid#12a94f8][rid#1ee71b0/initial] [perdir C:/var/www/topaz/] pass through C:/var/www/topaz/app/users

与通过vhost的输出相比:

[topaz.local/sid#18374e8][rid#1868310/initial] init rewrite engine with requested uri /app/users/login
[topaz.local/sid#18374e8][rid#1868310/initial] applying pattern '^(/.*)$' to uri '/app/users/login'
[topaz.local/sid#18374e8][rid#1868310/initial] rewrite '/app/users/login' -> '/dispatch.php?url=/app/users/login'
[topaz.local/sid#18374e8][rid#1868310/initial] split uri=/dispatch.php?url=/app/users/login -> uri=/dispatch.php, args=url=/app/users/login
[topaz.local/sid#18374e8][rid#1868310/initial] local path result: /dispatch.php
[topaz.local/sid#18374e8][rid#1868310/initial] prefixed with document_root to C:/var/www/topaz/dispatch.php
[topaz.local/sid#18374e8][rid#1868310/initial] go-ahead with C:/var/www/topaz/dispatch.php [OK]

0 个答案:

没有答案