Directory Protect

Protect the files in a directory by routing requests through a Composr script. Composr will search for the page containing the linked content and only grant access if the current user has access to that page. Developers could customise the code to apply different permission rules.

You will need to add a new rule into your .htaccess file to control the routing. Assuming all the files were under a 'videos' directory:


RewriteRule ^(videos/.*)$ data_custom/directory_protect.php\?file=$1 [L,QSA]

Put the rule above this part of the Composr default:
# Anything that would point to a real file should actually be allowed to do so
RewriteCond %{DOCUMENT_ROOT}/git/$1 -f [OR]
RewriteCond %{DOCUMENT_ROOT}/git/$1 -l [OR]
RewriteCond %{DOCUMENT_ROOT}/git/$1 -d
RewriteRule (.*) - [L]
RewriteRule (.*) - [L]


Licensed on the same terms as Composr


Back to Top