Q:

how to set 301 redirection for URL having '?' like characters in URL?

I want to redirect all URLs having id after 'emailthisone?'.
forexampleL:
http://news4u.com/emailmeone?id=1234' . When this url is accessed it must be redirected to http;//news4u.com/new/emailmeone?id=1234.
I tried to set RedirectMatch 301 /emailmeone?(.*) http://news4u.com/new/emailmeone$1 But this will act even if '?' is after 'emailmeone'.
How to achieve it.
Thanks

A:

If you use Redirect or RedirectMatch, although the query string will get appended automatically, there's no check that the query string is actually id=something:
RedirectMatch 301 ^/emailmeone$ /new/emailmeone

The ?id=1234 gets automatically appended to the end of the target. You could vet the id bit if you use mod_rewrite:
RewriteEngine On
RewriteCond %{QUERY_STRING} ^id=[0-9]
RewriteRule ^emailmeone$ /new/emailmeone [L,QSA]

