brothercake
09-01-2003, 07:41 PM
I'm using mod_rewrite to do "clean URLs", so a URL like "/site/portfolio/projects/" is rewritten into "?c=portfolio&s=projects".
So I've written this rule:
RewriteRule ^site/([a-z]+)[/]?([a-z]+)?[/]?([a-zA-Z=&]+)? /?c=$1&s=$2&$3
It's open ended so that something like "/site/portfolio/projects/foo=bar" can become "?c=portfolio&s=projects&foo=bar"
But that only works with manually generated URLs that don't have the "?" - I want to be able to use transient SID, and GET method forms, so it's gonna need to handle stuff like "/site/portfolio/projects/?foo=bar".
Okay ... so surely that's simply a case of adding a literal question mark into the expression:
^site/([a-z]+)[/]?([a-z]+)?[/]?[\?]?([a-zA-Z=&]+)?
But it doesn't work - everything after the "?" is lost. How come? Can I not have a literal question mark, or what's up?
So I've written this rule:
RewriteRule ^site/([a-z]+)[/]?([a-z]+)?[/]?([a-zA-Z=&]+)? /?c=$1&s=$2&$3
It's open ended so that something like "/site/portfolio/projects/foo=bar" can become "?c=portfolio&s=projects&foo=bar"
But that only works with manually generated URLs that don't have the "?" - I want to be able to use transient SID, and GET method forms, so it's gonna need to handle stuff like "/site/portfolio/projects/?foo=bar".
Okay ... so surely that's simply a case of adding a literal question mark into the expression:
^site/([a-z]+)[/]?([a-z]+)?[/]?[\?]?([a-zA-Z=&]+)?
But it doesn't work - everything after the "?" is lost. How come? Can I not have a literal question mark, or what's up?