Page is a not externally linkable
- Code, Content, and Presentation
-- Apache Web Server
---- RewriteRule not capturing full stops


lucy24 - 3:06 pm on Apr 16, 2012 (gmt 0)


"Capture non-slashes, stopping as soon as possible. Grab the first full stop you meet, and then capture the following 'html' or 'zip'."

There should be a closing anchor after this and all other expressions, but I forgot.

The question mark after a * or + changes a Regular Expression from its regular "greedy" mode to "stingy" mode. (No, I do not know why RegEx terminology all has to do with food.) It's generally a last-resort option when things are too complicated to write an absolutely perfect capture. The idea is to save a few nanoseconds of backtracking. So if it turns out that your ".html" or ".zip" is followed by another full stop plus extension, the [^/] permits the RegEx to count the first ".xtn" as part of its capture and continue gobbling.


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