I’ve got a regular expression that redirects any files in the folder “/downloads” to a PHP script which then serves the file (alongwith other stuff). However, I’d like to have some PHP files in there that I can view, and not have them download (also a security problem, obviously). However, I don’t know that much about regular expression. I’m looking nito it, but not getting it right 🙁
<IfModule mod_rewrite.c>
RewriteEngine on
#Redirect any file coming in to the downloads manager
RewriteRule ^(.+\.*) /downloads?file=$1 [R,L]
</IfModule>
The only thing I can find so far that could work is RewriteRule ^(.+\.php)$ - [L]. However, this does not work. If anyone could quickly explain this, or give me something tha twill work, that would be great!
Also, as you may have figured out this redirects to the index.php of the /downloads folder. If you could explain why it doesn’t download itself, that would be great. It does download when I go to downloads/index.php, but not simply /downloads. Not required information to get it working, but would like to know 🙂
Thanks for any replies.
Use a
RewriteCondto forbid matches you don’t want:(I removed the
Lsince it didn’t have any use here)