Reputation: 1224
I was trying to redirect a specific page with unpredictable GET-Params
http://example.com/colours/hex.php?h=210&s=100&v=80...
to another page which shall receive the GET-Params
https://newsite.com/colorful/hexadecimal.php?h=210&s=100&v=80...
My try looked like this:
Redirect /colours/hex.php https://newsite.com/colorful/hexadecimal.php
But this only worked when no GET-Parameters were specified. It seems like the Server doesn't recognize the page otherwise, how do I make it noticing the GET-Parameters?
I am not very experienced with this so you may help me understanding the following, too: The .htaccess shall be placed within the colours folder at example.com . But the paths within the htaccess refer to the root-folder of the Domain, so I have to add /colours/ before hex.php, otherwise it doesn't work. Why is this so?
Upvotes: 1
Views: 83
Reputation: 143886
Try using mod_rewrite instead, you'll need to make sure mod_rewrite is loaded (otherwise the rules will cause a 500 server error). So in the htaccess file in the example.com document root, add these rules to it:
RewriteEngine On
RewriteRule ^colours/hex\.php$ https://newsite.com/colorful/hexadecimal.php [L,QSA,R]
You can change the R
to a R=301
to make the redirect permanent. The query string should automatically get appended to the new URL.
Upvotes: 2