Forum Moderators: phranque
All I need to do is to change a dynamic url to a different dynamic one using htaccess (although the actual parsed data for each will stay the same). It becomes difficult because as you no doubt no you can't use a dynamic url in the standard RewriteRule statement.
So I need to change...
example.com/folder/index.php?args=1&args=2
to
example.com/newfolder/newfile.php?args=123
if anybody knows how to do this in htaccess it would be very, very appreciated.
Thanks.
RewriteCond %{QUERY_STRING} ^args1=1&args2=2$
RewriteRule ^folder/index.php$ [site.com...] [R=301,L]
seems to work fine. If anyone notices something 'not quite right' with the above I'd be grateful for details othersie it seems fine :)
The only thing I see that's 'not quite right' is that you should escape the period in your RewriteRule pattern, because an unescaped period is a regular expressions token meaning 'any single character.'
RewriteCond %{QUERY_STRING} ^args1=1&args2=2$
RewriteRule ^folder/inde[b]x\.p[/b]hp$ http://www.example.com/newfolder/newfile.php?newargs=123 [R=301,L]
Jim