Rewrite的规则太复杂了。研究了半天都不知道所云。只好上来请教各位了 
   RewriteEngine On                
    RewriteCond %{REQUEST_URI} !^.*(\.css|\.js|\.html|\.zf|\.gif|\.pdf|\.rar|\.ppt|\.chm|\.png|\.jpg|\.jpeg)$
    RewriteRule ^(/.*)$ /index.php这些是什么意思

解决方案 »

  1.   

    此回复为自动发出,仅用于显示而已,并无任何其他特殊作用
    楼主【pilow】截止到2008-07-07 10:47:00的历史汇总数据(不包括此帖):
    发帖的总数量:1                        发帖的总分数:0                        
    结贴的总数量:1                        结贴的总分数:0                        
    无满意结贴数:1                        无满意结贴分:20                       
    未结的帖子数:0                        未结的总分数:0                        
    结贴的百分比:100.00%               结分的百分比:---------------------
    无满意结贴率:100.00%               无满意结分率:---------------------
    敬礼!
      

  2.   

    除换行符以外,任意字符,以.gif或.jpg..等等这些结尾
    例子
    a.gif,b.jpg.
      

  3.   

    <VirtualHost *:80>
        ServerAdmin [email protected]
        DocumentRoot D:\project\www\admin
        DirectoryIndex index.php index.html
        ServerName admin.shop
        RewriteEngine on                
        RewriteCond %{REQUEST_URI} !^.*(\.css|\.js|\.html|\.zf|\.gif|\.pdf|\.rar|\.ppt|\.chm|\.png|\.jpg|\.jpeg)$
        RewriteRule ^(/.*)$ /index.php  
    </VirtualHost>
    <VirtualHost *:80>
        ServerAdmin [email protected]
        DocumentRoot D:\project\www\web
        DirectoryIndex index.php  index.html
        ServerName web.shop
        RewriteEngine on
        RewriteCond %{REQUEST_URI} !^.*(\.css|\.js|\.gif|\.jpg|\.png|\.jpeg|\.html)$
        RewriteRule ^(/.*)$ /index.php
    </VirtualHost> 这是apache的配置。
    现在我访问admin.shop 或者web.shop都是显示admin下面的index界面。并且我访问在D:\project\www的test.php也是显示admin下面的index。为何?
      

  4.   

    \.css ¦\.js ¦\.html ¦\.zf ¦\.gif ¦\.pdf ¦\.rar ¦\.ppt ¦\.chm ¦\.png ¦\.jpg ¦\.jpeg
    不是上述最字符串结尾的请求,全部发向/index.php比如请求
    /xxx/style.css  是直接请求实际文件
    如果是请求
    /x.jsp 或 /asdf.asp  /sadf.php /sadf.xxx
    全部发向/index.php
      

  5.   

    这个我知道。我现在的问题就是两个虚拟主机都有自己的目录和index.php
    比如对于DocumentRoot D:\project\www\admin 下面有个index.php
    那么我访问192.168.1.1\admin\bbbb.应该调用admin下面的index.php
    而访问192.168.1.1\web\aaaa,应该调用web下面的index.php
    结果我现在不论访问192.168.1.1下面的什么文件。都给我调用了admin下面的index.php
    不知道是哪里的问题
      

  6.   

    我的配置文件是这样配置的:如果我把第一个虚拟机注释掉。那么无论访问什么页面。都会重定向到web下面的index.php。如果两个虚拟主机都起作用。那么都会重定向到admin下面的index。难道不能同时存在两个虚拟主机》
    <VirtualHost *:80>
        ServerAdmin [email protected]
        DocumentRoot D:\project\www\admin
        DirectoryIndex index.php index.html
        ServerName admin.shop
        RewriteEngine on                
        RewriteCond %{REQUEST_URI} !^.*(\.css|\.js|\.html|\.zf|\.gif|\.pdf|\.rar|\.ppt|\.chm|\.png|\.jpg|\.jpeg)$
        RewriteRule ^(/.*)$ /index.php  
    </VirtualHost>
    <VirtualHost *:80>
        ServerAdmin [email protected]
        DocumentRoot D:\project\www\web
        DirectoryIndex index.php  index.html
        ServerName web.shop
        RewriteEngine on
        RewriteCond %{REQUEST_URI} !^.*(\.css|\.js|\.html|\.zf|\.gif|\.pdf|\.rar|\.ppt|\.chm|\.png|\.jpg|\.jpeg)$
        RewriteRule ^(/.*)$ /index.php
    </VirtualHost>
      

  7.   

    一般写在.htaccess文件中,问题就会少很多。还有就是你的正则似乎写得有点问题,我给一句简单点的你参考:RewriteRule !\.(js|ico|gif|jpg|png|css)$ index.php实现同样的效果。里边的扩展名你可以自己加。
      

  8.   

    一般写在.htaccess文件中,问题就会少很多。还有就是你的正则似乎写得有点问题,我给一句简单点的你参考:[code]
    RewriteRule !\.(js|ico|gif|jpg|png|css)$ index.php
    [/code]实现同样的效果。里边的扩展名你可以自己加。竖线被CSDN转义了~~~~郁闷。
      

  9.   

    楼主漏掉一个重要的参数
    ServerAlias exapmle.com www.example.com
    即使存在多个虚拟主机也能针对每一个写rewriter这个没有问题的
      

  10.   

    楼主你第一个问题和第二个问题有本质的区别
    1 是url重写
    2 是虚拟机的配置两个请分开
      

  11.   

    如果我吧虚拟主机注释掉。然后配置.htaccess文件
    RewriteEngine onRewriteRule !\.(js|ico|gif|jpg|png|css|html)$ Index.php
    结果访问出现
    Forbidden
    You don't have permission to access / on this server.