Preventing access to everything but the content of the public folder via htaccess
What would be the correct and most widely used way to prevent users from directly accessing anything outside my public folder? I am currently rewriting URLs in a Zend fashion - with thi开发者_如何学Gos (parameter processing is done in PHP):
RewriteCond $1 !^(index\.php|template|images|modules|lib|robots\.txt)
RewriteRule ^(.*)$ index.php?path=$1 [L,QSA]
Could a regex guru lend a hand on turning it into a failproof rule for excluding all folders outside "public" or will I have to list them all in the condition above?
Thank you
I doubt you really want to prevent users from accessing images folder or robots.txt
It's only php code and private files that probably needs to be secured.
So, just place your PHP files above your public folder.
That's all.
精彩评论