Forum Moderators: phranque

Message Too Old, No Replies

mod_rewrite, cannot get it work. need assistance.

add extra _GET param

         

fragttdg

9:18 am on Jan 25, 2006 (gmt 0)

10+ Year Member



Hi all,

Please take a look at the problem:
URL A:
[user1.sample.com...]

URL B:
[sample.com...]

And the following is from my .htaccess:
RewriteCond %{HTTP_HOST} ^([^.]+)\.sample\.com
RewriteRule ^dir1/(.+) /A/dir1/$1?&user=%1 [L]

It seems that $1 does not include everything, when I try to access URL A, it only got 'user', param1 and param2 are lost!

Please could you kindly give me some hint on this. My intention is to implement only 'php' pages with the above rule, that means I only need to redirect the URLs with '.php'. But now, I cannot get the simplest work.

jdMorgan

4:18 pm on Jan 25, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



fragttdg,

Welcome to WebmasterWorld!

Add the [QSA] flag (Query String Append) to the RewriteRule flags, so that your new 'user=' querystring parameter is appended to the existing query string, instead of replacing it.

Replacing the existing query is the default behaviour if a new query string is specified in the substitution URL in the rule.

See qsappendĤQSA under Apache mod_rewrite RewriteRule [httpd.apache.org].

Jim