HTACCESS不重定向参数

I got this line of code:

RewriteRule artistprofile.php rewrite.php?$1 [R=301,L]

But the redirection does not work accordingly,

http://domain.com/artistprofile.php?displayname=bryan+wong is redirected to http://domain.com/rewrite.php?/

I am expecting http://domain.com?displayname=bryan+wong

Please help!

You have to use the QSA flag, like this:

RewriteRule artistprofile.php rewrite.php [R=301,L,QSA]

Now, the URL http://domain.com/artistprofile.php?displayname=bryan+wong will be redirected to http://domain.com/rewrite.php?displayname=bryan+wong.

You didn't catch the query first to use $1 try this

RedirectMatch /artistprofile.php?displayname=(.*)$ rewrite.php?displayname=$1