虚拟机的DocumentRoot路径是/var/www/html/dir1/dir2
rewrite规则是写在.htaccess文件中的。
RewriteEngine on
RewriteBase /
RewriteRule rewrite.html index.php这个时候,访问正常。如果改成:RewriteEngine on
RewriteBase /
RewriteRule rewrite.html index.php [P,L]就会发生错误,chrome浏览器返回:
The requested URL /var/www/html/dir1/dir2/index.php was not found on this server.
应该是404了吧?请问发生这个错误的原因是什么,应该如何处理。

解决方案 »

  1.   

    P(force proxy) 强制使用代理转发。
    L(last rule) 表明当前规则是最后一条规则,停止分析以后规则的重写。不明白为什么要 P
      

  2.   

    RewriteRule rewrite.html index.php [NC]
    用NC修饰试试
      

  3.   


    不瞒您说,其实我也不是很明白。
    俺是因为某个项目,刚刚开始学习rewrite,很白。
    这里加P,是从某些例子中看来的。可,无论如何,为啥加了P,就出这种问题呢?
      

  4.   

    加了P就表示要使用代理转发
    而 你的 RewriteBase 为 / 在配上物理路径就是 /var/www/html/dir1/dir2/index.php
    如何能找到?