I'm just curious why it isn't working when I think it should. For the production server I will be using nginx web server either way. I just want to learn something useful about Apache. Additionally Directory and DirectoryMatch aren't avaiable in htaccess files. So my question still remains. On 16 September 2011 01:07, Igor Cicimov <icicimov@xxxxxxxxx> wrote: > Why dont you use Directory statement instead with Allow/Deny and modify the > default 404 page? > > On Sep 16, 2011 4:13 AM, "Sebastian Tarach" <starach@xxxxxxxxx> wrote: >> Hello, >> I have all my files that I want clients to have access to in one >> folder named assets. I want to forbid direct access to any other >> folders and their files. >> >> RewriteCond %{REQUEST_FILENAME} -f [OR] >> RewriteCond %{REQUEST_FILENAME} -d >> RewriteRule \.(?!assets.+)$ index.php?path=error404 >> >> RewriteCond %{REQUEST_FILENAME} !-f >> RewriteCond %{REQUEST_FILENAME} !-d >> RewriteRule ^(.*)$ index.php?path=$1 >> >> This does not work for some reason. I mean although it allows access >> to any files and folders within assets but it blocks access to non >> existing folders. For instance when I type in domain.com/home or >> domain.com/contact-us or anything else that isn't a folder it treats >> it as a folder ( or file :| ) and redirects me to >> index.php?path=error404 instead of executing second set of rules. Why >> is that and how to fix it? >> >> Regards >> >> --------------------------------------------------------------------- >> The official User-To-User support forum of the Apache HTTP Server Project. >> See <URL:http://httpd.apache.org/userslist.html> for more info. >> To unsubscribe, e-mail: users-unsubscribe@xxxxxxxxxxxxxxxx >> " from the digest: users-digest-unsubscribe@xxxxxxxxxxxxxxxx >> For additional commands, e-mail: users-help@xxxxxxxxxxxxxxxx >> > --------------------------------------------------------------------- The official User-To-User support forum of the Apache HTTP Server Project. See <URL:http://httpd.apache.org/userslist.html> for more info. To unsubscribe, e-mail: users-unsubscribe@xxxxxxxxxxxxxxxx " from the digest: users-digest-unsubscribe@xxxxxxxxxxxxxxxx For additional commands, e-mail: users-help@xxxxxxxxxxxxxxxx