I want to redirect this way: from www.example.com/link.php?a=1&b=1 to www.example.net/subdirectory/link.php?a=1&b=1
I tried to use this .htaccess which isn't working:
Options +FollowSymLinks
RewriteEngine On
RewriteBase /
RewriteCond %{HTTP_HOST} ^(www\.)?example\.com$ [NC]
RewriteRule ^(.*)$ http://www.example.net/subdirectory$ [L,R=301]
The above redirects www.example.com/link.php?a=1&b=1 to www.example.net/subdirectory/?a=1&b=1, omitting the link.php part.
System is apache2.2 + mod_rewrite running on debian wheezy 64bit. Thanks in advance.