我想排除mod_rewrite为一个特定的目录。
我希望文件夹“phd_application”不被重写,也就是当一个url指向的时候
www.myserver.com/phd_application
它去那个文件夹。
它在上传到Web服务器时工作,但不能在本地工作,我不明白为什么。 我有本地和远程相同的.htaccess文件。 我错过了什么?
我有以下.htaccess
<IfModule mod_rewrite.c> RewriteEngine on RewriteRule ^(phd_application/) - [L] RewriteRule ^$ app/webroot/ [L] RewriteRule (.*) app/webroot/$1 [L] </IfModule>
.htaccess所在目录的内容
-rwxr-xr-x 1 183 Dec 19 12:43 .htaccess drwxr-xr-x 13 18 Dec 13 15:44 app lrwxrwxrwx 1 15 Dec 13 14:48 cake -> ../CakePHP/cake -rwxr-xr-x 1 1850 Dec 13 15:14 index.php drwxr-xr-x 3 8 Dec 19 12:46 phd_application lrwxrwxrwx 1 18 Dec 13 14:49 plugins -> ../CakePHP/plugins lrwxrwxrwx 1 18 Dec 13 14:50 vendors -> ../CakePHP/vendors
日志是什么意思? 在本地机器上启用rewritelog,并检查发生了什么。
除了全球重写之外的一个位置的FYI用RewriteCond更好。
例:
RewriteRule ^$ app/webroot/ [L] RewriteCond ${REQUEST_URI} !^phd_application/ RewriteRule (.*) app/webroot/$1 [L]