EDIT: Having issues with the code below
Okay, I'm getting a page that says "The page isn't redirecting properly". This is if someone tries to access /files/protected/file.jpg. I'm trying to redirect it to /myfiles/file.jpg, but instead I get that error...
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteBase /myfiles/
RewriteRule ^(.*)$ $1 [L,R=301]
</IfModule>
Essentially, I'm trying to figure out how to add a rewrite condition that will retain part of the path. If a user tries, for example, to access a file within a directory, it redirects to another url with that filename as a parameter.
So, if a user visits: mysite.com/protected/file.pdf, it will redirect to mysite.com/okay/file.pdf
Is that something that I can use .htaccess for?