I have a CMS System that converts the ugly URLs into more friendly ones.
So far instanstance, instead of the page url being something like this:
/pagebase.php?id=3644
I have a url write setup for each page to make it more friendly.
For example:
RewriteRule ^/events$ /pagebase.php?id=3644 [I]
So that when the user types in domain.com/events they pull up above url.
This works for almost all pages except this one where I need to add additional query strings so I can do something like this.
www.domain.com/events?y=2010=&m=&1d=2
That would rewrite as
www.domain.com/pagebase.php?id=3366&y=2010=&m=&1d=2.
The only problem is the url write match fails because it doesn't see the ?y=2010=&m=&1d=2 as a query string, it sees it as part of the url and fails.
I need to modify my rewrite file to allow query strings to be passed through.
I want to do something like RewriteRule ^/events-%QUERYSTRING% $ /pagebase.php?id=3644 + %QUERYSTRING% [I]
Where it removes the query string from the match but then appends it to the end of the written url. I just don't have enough knowledge on how url rewrites work to do this.
Here is an example of my rewrite file.
RewriteRule ^/events$ /pagebase.php?id=3644
RewriteRule ^/faqs$ /pagebase.php?id=3659
RewriteRule ^/gallery$ /pagebase.php?id=3645
RewriteRule ^/gifts$ /pagebase.php?id=3646
I need something that will work on all pages, I don't want to have to modify each rule to handle specific query strings, I just want a generic solutions that will pass the query strings through.
You may try matching an optional query string, and have it appended by the [QSA]
modifier:
RewriteRule ^/events(\?.*)?$ /pagebase.php?id=3644 [QSA,L]
RewriteRule ^/faqs(\?.*)?$ /pagebase.php?id=3659 [QSA,L]
RewriteRule ^/gallery(\?.*)?$ /pagebase.php?id=3645 [QSA,L]
RewriteRule ^/gifts(\?.*)?$ /pagebase.php?id=3646 [QSA,L]