Reputation: 7243
This is a RewriteRule I got:
RewriteRule ^([^/]+)(/.*.(js|css))$ ../../lib/minify/m.php?f=$2&d=$1
I understand that $2 and $1 reference the expressions in brackets. Can somebody explain what $2 and $1 would be, looking at this URL, please?
http://something.com/skin/m/1393854026/js/prototype/prototype.js,/js/prototype/window.js,/js/scriptaculous/builder.js
Somehow on my local machine, $_GET['f'] is filled. But it is not working in my server.
May i know how to make it possible ?
Upvotes: 0
Views: 63
Reputation: 7050
basically, there are 3 capturing groups. the third group will be ignored by this rule, that means, that the last .js will be 'chopped' off. but, if you are matching against that URL, it will give you:
1. `http:`
2. `//something.com/skin/m/1393854026/js/prototype/prototype.js,/js/prototype/window.js,/js/scriptaculous/builder.js`
3. `js`
and I guess that's not what you want. you can test it here http://regex101.com/#python
even if you starts at the first 'non-/' that the rule is about, you will "miss" the /skin
part of the request
I'm giving a shot that you just want the paths, so the rule would be:
(?=/(js|css))(.+\1)
would match:
1. [39-41] `js`
2. [38-117] `/js/prototype/prototype.js,/js/prototype/window.js,/js/scriptaculous/builder.js`
and for a CSS url like http://something.com/skin/m/1393854026/css/prototype/prototype.css,/css/prototype/window.css,/css/scriptaculous/builder.css
1. [39-42] `css`
2. [38-123] `/css/prototype/prototype.css,/css/prototype/window.css,/css/scriptaculous/builder.css`
Upvotes: 2