Redirect using RewriteRule in the file folder. How?

The site moved to a new dvizhek.
The old engine was the links to the user view /instruction.php?instr=blabla.pdf
On a new engine file instruction.php no, I've found instructions are in the folder /media/
How to use RewriteRule to do the redirect with /instruction.php?instr=blabla.pdfon /media/blabla.pdf
PS. File names may be different, that is the pattern you need
Did not work
RewriteRule ^instruction.php?instr=(.*)$ media/$1
March 19th 20 at 08:51
1 answer
March 19th 20 at 08:53
RewriteEngine On
RewriteRule ^media/([^/]*)$ /instruction.php?instr=$1 [R=301, L]
Him in the other direction - Idella_Reinger commented on March 19th 20 at 08:56
Yes, in the other direction - juwan commented on March 19th 20 at 08:59
@juwan, @Idella_Reinger, no problem

RewriteCond %{QUERY_STRING} ^instr=(.*)$
RewriteRule ^instruction\.php$ <a href=""></a> [R=301,L]
- paolo_Runolfsdottir commented on March 19th 20 at 09:02

Find more questions by tags Processing URLhtaccessApache