[UPHPU] help with rewrite rule

Lamont Peterson peregrine at openbrainstem.net
Wed Feb 6 18:31:24 MST 2008


On Wednesday 06 February 2008 04:16:31 pm Wade Preston Shearer wrote:
> In case anyone is interested, I figured it out. Apparently, you cannot
> escape a question mark in a mod_rewrite rule as note here:
>
> http://iandouglas.com/mod-rewrite-hack-in-php-for-redirecting-old-urls-with
>-question-marks/

I don't have time to go digging on this at the moment, but the notes at this 
first URL are, I think erroneous in their description of the interpretation 
of the question mark (?) in regex.  Unless mod_rewrite is doing something 
non-standard with them.

The question mark, along with the asterisk (*) and plus sign (+) are the three 
main "quantifiers" in regular expressions.  They only affect the atom which 
immediately precedes them.  So, in the example on the iandoulas.com 
website, "abc?def.html" would match either "abcdef.html" or "abdef.html".

> So, the solution is to use a rewrite condition, as discussed here:
>
> http://forums.digitalpoint.com/showthread.php?t=16014

Excellent.  This is good stuff to know.  Honestly, I can't remember ever 
trying to create mod_rewrite rules with question marks in them before, so I 
was not aware of the issue.
-- 
Lamont Peterson <peregrine at OpenBrainstem.net>
Founder [ http://blog.OpenBrainstem.net/peregrine/ ]
GPG Key fingerprint: 0E35 93C5 4249 49F0 EC7B  4DDD BE46 4732 6460 CCB5
  ___                   ____            _           _
 / _ \ _ __   ___ _ __ | __ ) _ __ __ _(_)_ __  ___| |_ ___ _ __ ___
| | | | '_ \ / _ \ '_ \|  _ \| '__/ _` | | '_ \/ __| __/ _ \ '_ ` _ \
| |_| | |_) |  __/ | | | |_) | | | (_| | | | | \__ \ ||  __/ | | | | |
 \___/| .__/ \___|_| |_|____/|_|  \__,_|_|_| |_|___/\__\___|_| |_| |_|
      |_|               Intelligent Open Source Software Engineering
                              [ http://www.OpenBrainstem.net/ ]


More information about the UPHPU mailing list