[Melbourne-pm] Apache re-write help

Jacinta Richardson jarich at perltraining.com.au
Mon Feb 22 03:41:24 PST 2010


Scott Penrose wrote:

>>> 	RewriteEngine on
>>> 	RewriteRule ^features/([^/]+)/([^/])+/?$  features?title=$1&venue=$2 [L]

>> Slightly broken regex there (the repetition operator should come inside
>> the capture), but I think that looks about right. You should also add
>> the [QSA] (query string append) flag to make sure that, well, the query
>> string gets appended :P
> 
> It won't rewrite the query string, just append it.

I think that's fine.  I'm talking about changing my code so that it has sane 
looking urls, and then rewriting those to query strings.

>>    RewriteRule ^(.*)$ wiki/index.php?title=$1 [L,QSA]
> 
> Yes that way round is fine, but you can't do a regex on the left. I.e. you can add a query string of the data on the right.

Yup, I want sane url to be generated by my code, and then to turn that into a 
query string just for the server (such that the client never need know what 
they're dealing with underneath.

Thanks Robert and Scott.

	J


More information about the Melbourne-pm mailing list