开发者

Can these two rewrite rules be written in a better way/merged?

I have the following rewrite rules:

RewriteRule ^(.*)/(stylesheets|javascript)/[0-9]+/(.*)$ /$1/$2/$3 [L]
RewriteRule ^(stylesheets|javascript)/[0-9]+/(.*)$ /$1/$2 [L]

it lets me do /foo/stylesheets/123456/bar.css which maps to /foo/stylesheets/bar.css and /stylesheets/123456/bar.css which maps to /stylesheets/bar.css

However I was just wondering if they could be merged somehow?

I tried changing it to just:

RewriteRule (stylesheets|javascript)/[0-9]+/(.*)$ $1/$2 [L]开发者_运维知识库

but that didn't work for anything with /foo/stylesheets/

Thanksl


Try this one:

RewriteRule ^(.+/)?(stylesheets|javascript)/[0-9]+/(.*)$ /$1$2/$3 [L]

I'm just unsure how much performance it will give you (maybe even opposite).

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜