Forum Moderators: phranque
I'm still relatively n00b when it comes to RegEx and .htaccess, so please excuse any ignorance that might show through :)
Let's assume I have a website URL,
http://example.org/articles/. This URL will be remapped to http://example.org/index.php?page=articles. Then we have a second website URL, but one that looks more like
http://example.org/articles/?id=329. This URL will need to be remapped to http://example.org/index.php?page=articles&id=329. Now, I've read about the [QSA] flag that can be applied to the RewriteRule directive (is that what it is called?), and it still doesn't seem to help me.
Basically, this is the .htaccess code that I already have:
RewriteCond %{REQUEST_URI} ^/([a-z]+)/? [NC]
RewriteRule (.*) /index.php?page=%1
And that is about as far as I can get. I have tried all manner of different variations in order to append the
?id to the original querystring, but nothing seems to work. I'd really appreciate it if anyone could help me in this. Thanks.
RewriteCond $1 !^index\.php$
RewriteRule ^([a-z]+)/?$ /index.php?page=$1 [L]
RewriteCond $1 !^index\.php$
RewriteRule ^$ /index.php?page=articles [QSA,L]
RewriteRule ^articles/?$ /index.php?page=articles [QSA,L]
Jim
[edit] Fixed disastrously-bad formatting and errors (due to fatigue?). :o [/edit]
[edited by: jdMorgan at 2:15 pm (utc) on May 16, 2008]