So, I'm hoping to use CodeIgniter's .htaccess method to help in managing files that are directly linked to and stopping download of files that need proper credentials. I cannot use a password-protected folder for this.
RewriteEngine On
RewriteBase /library/
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_URI} !^(index\.php|docs|scripts|library\.php)
RewriteRule ^(.*)$ index.php/$1 [QSA,L]
What I have is a folder full of files. Some of them can be accessed without credentials, some cannot. What I need to do is have Apache call up a PHP script that will check the file being requested for proper credentials if it's a secured file. If the credentials aren't met, it should show an error page with login form. If they are met, the file needs to be a forced download to the browser. Publicly available files should just automatically get sent to the browser.
So, how would I go about using the .htaccess file to send the file being requested to the PHP script? I hope I've explained this well enough. Basically, I need to stop direct links to files that should be protected.
Thanks for any help!