I have this URL:
oldsite.com/profile.php?uid=10
I would like to rewrite it to:
newsite.com/utenti/10
How can I do that?
The $
n
only refer to the matches of the RewriteRule
directive. Use %
n
to reference the matches of the corresponding RewriteCond
directive.
Additionally you need to specify an empty query for the substitution. Otherwise the original query will be used.
And if you want to have the rest of the query to stay intact, use this rule:
RewriteCond %{QUERY_STRING} ^(([^&]*&)*)uid=([0-9]+)(.*)
RewriteRule ^profile\.php$ http://new.example.com/utenti/%3?%1%4 [R=301,L]