I have a website for GIFs and I want when a user tries to access to a GIF he will be redirected to another route. For example, if he types in the URL bar https://example.com/gif/YqHiZ3Mp.gif he will be redirected to https://example.com/gif/embed/YqHiZ3Mp I tried this in .htaccess but nothing happened  RewriteCond %{REQUEST_FILENAME} !-f RewriteRule ^gif/([a-zA-Z0-9]+)\.gif$/gif/embed/$1 [L,NC]  Also wich .htaccess I have to edit? under /web directory?
 I find this solution  RewriteEngine On RewriteCond %{REQUEST_FILENAME} !-f RewriteRule ^gif/([a-z\d]+)\.(gif)$/gif/embed/$1 [R=301,L,NC]  but when I try to call a GIF with HTML or javascript it will be redirected too. Is there any way to ignore this rule when the call comes from code?