Apache mod_mem_缓存可能会发生变化,但需要重新编写规则建议

Apache mod_mem_缓存可能会发生变化,但需要重新编写规则建议,apache,caching,mod-rewrite,url-rewriting,Apache,Caching,Mod Rewrite,Url Rewriting,如果查询字符串?g并键入css或js-gzip deflate被禁用 RewriteCond %{REQUEST_URI} \.(css|js)$ RewriteCond %{REQUEST_METHOD} GET RewriteCond %{QUERY_STRING} ^g$ RewriteRule ^(.*)$ $1 [QSA,E=no-gzip:1,PT,L] 如果用户代理不支持gzip,则重定向到文件witch查询字符串?g eq.style.css?g RewriteCond

如果查询字符串?g并键入css或js-gzip deflate被禁用

RewriteCond %{REQUEST_URI} \.(css|js)$

RewriteCond %{REQUEST_METHOD} GET

RewriteCond %{QUERY_STRING} ^g$

RewriteRule ^(.*)$ $1 [QSA,E=no-gzip:1,PT,L]
如果用户代理不支持gzip,则重定向到文件witch查询字符串?g eq.style.css?g

RewriteCond %{REQUEST_URI} .(css|js)$

RewriteCond %{REQUEST_METHOD} GET

RewriteCond %{HTTP:Accept-Encoding} !^gzip\,deflate$

RewriteCond %{QUERY_STRING} !^g$

RewriteRule "^([a-zA-Z0-9_-]*)\.(css|js)$" $1.$2?g [R=301]
我的问题是,对于301,需要rel path,但要转到default dir

http:// localhost/style/style.js -> http://d:\some\path/style.js?g

http:// localhost/js/e.js -> http://d:\some\path/e.js?g
要解决这个问题,我认为需要了解真实路径eq

RewriteRule "^([a-zA-Z0-9_-]*)\.(css|js)$" http://%{HOST}/%{PATH}/$1.$2?g [R=301]
但是我不知道如何命名这个

重写规则“^([a-zA-Z0-9-]*)\(css | js)$”http://%{http\u HOST}%{REQUEST\u URI}?g[R=301]