httpd-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Hans Juergen von Lengerke <lenger...@sixt.de>
Subject Re: [users@httpd] Is mod_rewrite the solution for this...?
Date Thu, 05 Sep 2002 07:48:55 GMT
dale's stuff <stuff@colony.net> on Sep 4, 2002:

> >   RewriteRule ^/members/(([^/]{2})[^/]*)/(.*)$ /members/$2/$1/$3
>
> If I understand this correctly, (I have never used mod_rewrite) this is
> looking in the members folder, getting the first 2 charactors after the /
> then re-writing that to /members/$2 (this is the leading 2 charactors of
> the nickname) /$1 (where this is the nickname value) and $3 ? this is
> anything after the trailing / after the nickname.
>
> Is that correct?

Yes, that is more or less correct. The pattern (the first argument to
RewriteRule) says in English:

   ^           # If a requested URL starts with
   /members/   # the string "/members/"
   (           # [start storing matches in $1]
    (          # [start storing matches in $2]
     [^/]{2}   # match two chars that aren't a "/"
    )          # [end storing matches in $2]
    [^/]*      # match any chars that aren't a "/"
   )           # [end storing matches in $1]
   /           # followed by a "/"
   (           # [start storing matches in $3]
    .*         # any number of any chars
   )           # [end storing matches in $3]
   $           # up to the end of the URL


Check out any tuturials/guides on the web on "Regular Expressions".
Another good resource is Jeffrey Friedls "Mastering Regular Expressions"
from O'Reilly.


---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Mime
View raw message