我写了一个.htaccess文件用于web资源管理。
我想将此模式的URI用于静态资源
^.*/web-console/static/(.*)$而且,我的RewriteRule在下面。
RewriteRule "^.*/web-console/static/(.*)$" "resources/floworks-web-console-1.0/static/$1" [L]并且,我请求下面的URI
http://myhost/shop/web-console/static/css/default.css但是Apache服务器与URI不匹配。
如果我删除"/web-console“,Apache就能正常工作。
下面是RewriteRule
RewriteRule "^.*/static/(.*)$" "resources/floworks-web-console-1.0/static/$1" [L]什么是问题?
附录
这是我的目录结构
web基础- /data/web
站点基础- /data/web/shop
htaccess - /data/web/shop/.htaccess
路由器脚本- /data/web/shop/route.php
静态资源- /data/web/shop/resources/floworks-web-console-1.0/static
css文件- /data/web/shop/resources/floworks-web-console-1.0/static/css/default.css
因此,如果URI启动/shop/web-console/static,我希望响应静态资源
而且,其他情况使用"RewriteRule .* route.php L“传递给路由器脚本
发布于 2015-11-06 22:36:12
你应该可以这样做。如果你在子文件夹shop中有这个.htaccess,你应该添加rewritebase。
RewriteEngine On
RewriteBase /shop/
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule "^web-console/static/(.*)$" "resources/floworks-web-console-1.0/static/$1" [L]发布于 2015-11-11 23:38:47
我发现了我自己。
RewriteRule "web-console/static/(.*)$" "resources/floworks-web-console-1.0/static/$1" [END]我会将该标志从L更改为END
谢谢。
https://stackoverflow.com/questions/33568901
复制相似问题