Every other week I hear about some luscious new feature in 2.4. The latest:
<If...>
Not <IfDefine...> or the detestable <IfModule...>, but an all-encompassing <If {absolutely anything in the world}>. AND <ElseIf> and <Else>.
And it can be used in .htaccess.
:: slobber ::
Leosghost
11:18 pm on Aug 28, 2012 (gmt 0)
Mouth definitely watering here..
phranque
4:29 am on Aug 29, 2012 (gmt 0)
shut. up. =8) can't believe i hadn't noticed that yet...
MickeyRoush
2:37 pm on Sep 21, 2012 (gmt 0)
I know this maybe a bit different, but I was examining some REGEX code someone else provided and it kind of had me stumped as I wasn't sure what it was trying to do until I came across this:
As anyone ever used If-Then-Else conditionals with REGEX for mod_rewrite?
Example:
(?(1)A|[BCD])
If "A" matches then see if "B", "C", or "D" matches.
Otherwise it fails.
lucy24
8:01 pm on Sep 21, 2012 (gmt 0)
I know that they exist but my text editor doesn't support them so I never got in the habit. Does it work in mod_rewrite? If nobody knows, try it with some made-up page names ("if it contains 'foo' then see if it also contains 'bar' etc). It could be especially useful testing query strings that don't come in a fixed order.
(?(1)A|[BCD]) If "A" matches then see if "B", "C", or "D" matches.
Are you sure about the syntax? To me it seems to mean "If a previously defined capture 1 exists-- that is, has non-null content-- then match A, else match [BCD]".
The regex (a)?b(?(1)c|d) matches bd and abc. It does not match bc, but does match bd in abd.
That's "Looking Inside the Regex Engine", the first <h2> on the page. (The previous one looks identical but is <h1>. Heh, heh.) It goes on for four excruciatingly detailed paragraphs, winding up firmly in jdmorgan territory ;)