如题,我现在的规则是:<IfModule mod_rewrite.c>
RewriteEngine on
RewriteRule    (captcha.php) images/captcha.php [L]
RewriteRule    (filter.js) scripts/filter.js [L]
RewriteRule    (jquery.js) scripts/jquery.js [L]
RewriteRule    (.css) styles/main.css [L]
RewriteRule    (.jpg) images/idea.jpg [L]
RewriteRule    (.*) index.php [L]
</IfModule>这样,每个请求都定向到index.php中来执行。但是图片等就直接重写了,所以我不得不添加这些重写js、css等的规则,如果我图片、css、js多了就很麻烦。求教大家~~谢谢

解决方案 »

  1.   

    参考Zend controller里的写法就行
      

  2.   

    <VirtualHost *:8088>
     ServerName www.agent.com:8088
     DocumentRoot "E:/Zend/Apache2/htdocs/agent.omov.cn"
     
     ErrorLog logs/rberror.log
     RewriteEngine On
     RewriteLog "logs/rbrewrite.log"
       RewriteLogLevel 9
       
       AddEncoding gzip .jgz
     AddType "text/javascript;charset=UTF-8" .jgz  AddEncoding gzip .zcss
     AddType "text/css;charset=UTF-8" .zcss
        
       
       <Directory "E:/Zend/Apache2/htdocs/agent.omov.cn">
     Options +FollowSymLinks -Indexes
       AllowOverride All
       Order Allow,Deny
       Allow from all
     </Directory>
     
     RewriteCond %{HTTP_HOST} ^www.agent.com:8088$ [NC]
     RewriteCond %{REQUEST_FILENAME} !-f
     RewriteCond %{REQUEST_URI} !^/css
     RewriteCond %{REQUEST_URI} !^/js
     RewriteCond %{REQUEST_URI} !^/images
     
     RewriteCond %{REQUEST_URI} !^.*(\.css|\.js|\.gif|\.png|\.jpg|\.jpeg|\.xml)
     RewriteRule ^/(.*)$ /public/index.php/$1 [L]
    </VirtualHost>