httpd-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Igor Cicimov <icici...@gmail.com>
Subject Re: [users@httpd] Restricting access to all folders except one using mod_rewrite
Date Thu, 15 Sep 2011 23:07:36 GMT
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@gmail.com> 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@httpd.apache.org
> " from the digest: users-digest-unsubscribe@httpd.apache.org
> For additional commands, e-mail: users-help@httpd.apache.org
>

Mime
View raw message