Forum Moderators: phranque
RewriteRule ^events/(.*)/([0-9]+)events/$1&photo=$2
RewriteRule ^events/([0-9]+)(.*)$events/index.php?id_event=$1$2
I expect events/01/61 to be rewritten to events/01&id_photo=61, which would then be rewritten to events.php?id_event=01&id_photo=61. The final result, however, is events.php?id_event=01&id_photo=61/61. When I put more variables, each with its RewriteRule, they all add repeated /(...) stuff at the end. Why is that?
[edited by: Monstah at 6:41 pm (utc) on Oct. 10, 2006]
Also, "events/01&id_photo=61" is an invalid URL, since "&" is only allowed in URL-paths if it is encoded.
Another angle is that if you wish to replace a query string, the subsitution must contain "?" followed by the query string to replace the current one -- Use just "?" with nothing after it to clear the current query string.
If, on the other hand, you wish to append to the current query string, then either use [QSA] or do it manually by using a RewriteCond to capture the current %{QUERY_STRING} and then back-reference it in the substitution URL.
So, there are several layers of problems here.
I suggest you "build" your new query string by starting with the "?" at the beginning, and then appending from there. That avoids the invalid unencoded "&" character problem, and will likely give you more predictable results.
Jim