Page is a not externally linkable
- Code, Content, and Presentation
-- Apache Web Server
---- need help with regex rewrite


lucy24 - 9:36 pm on Feb 10, 2012 (gmt 0)


Overlapping your last post, so scroll back:

Oh, good, you got most of it sorted out. And you understand it a lot better than if someone had just written it for you. Don't you? ;)

The remaining problems are:

-- You start your pattern with .+ so the RegEx has to keep backtracking: "Oops! I was supposed to capture '-rev' back there."

-- You've got your full stops . correctly escaped but they are in the wrong places. The last part needs to be

(\.min)?\.(js|css)

If the rev can never be anything but a number, you don't need to include the a-z options. Just [0-9]+ or even \d+.

The trickiest part is the beginning. For this you will have to figure out all the possible forms a filename can have. Most importantly, how deeply nested can it be? That is, how many directories.


Thread source:: http://www.webmasterworld.com/apache/4416301.htm
Brought to you by WebmasterWorld: http://www.webmasterworld.com