在VirtualHost里设置RewriteCond中%{REQUEST_FILENAME}无效的问题

问题发生在将.htaccess里的rewrite规则转移到VirtualHost里之后。
原因是%{REQUEST_FILENAME}依然指向相对路径。

RewriteCond %{REQUEST_FILENAME}
改为:
RewriteCond %{DOCUMENT_ROOT}%{REQUEST_FILENAME}
问题解决。

Rewrite的调试可以开启RewriteLog来跟踪:
http://httpd.apache.org/docs/2.0/mod/mod_rewrite.html#rewritelog

参考文章:
http://lufei-99999.blog.163.com/blog/static/748495420115845922988/

One Comment

发表回复

您的邮箱地址不会被公开。 必填项已用 * 标注

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>