I have the following line in my .htaccess
file:
Redirect 301 /folder1 https://www.example.com/folder2/file.php
This will redirect everything from /folder1
to https://www.example.com/folder2/file.php
.
I need a condition to only allow this redirection if the URL contains a mykey=
GET parameter, else ignore this redirection command.
How can I do that?
2
Answers
I finally found the a working solution:
You cannot do this using
Redirect
directive that does basic URI matching.You will need to use
mod_rewrite
based rules for this like this:Make sure to clear your cache before testing.
References: