blocking access to files and ORG_REQ_URI

#1
I am trying to block access to a directory containing files which I want to use internal redirect to deliver.

I tried placing this line in the rewrite rules for the Rails virtual host:

Code:
RewriteCond %{ORG_REQ_URI} ^/aaadownloads/
RewriteRule ^/aaadownloads/ - [R=403,F]
But it appears to do nothing. The files are still displayed or missing files show a 404.

I also tried turning on .htaccess overrides (for FileInfo) for the server, virtual host, and rails context, and putting that rule in a .htaccess in the directory - but it has no effect either.

Any ideas?
Or is there a way to use internal redirect without placing the files in a publicly accessible directory (even with the rewrite rule I'm a little afraid to put that in public)...

Thanks for any help
 

mistwang

LiteSpeed Staff
#2
If you put the rewrite rule in .htaccess in that directory, you should use,


RewriteCond %{ORG_REQ_URI} ^/aaadownloads/
RewriteRule .* - [R=403,F]


"/aaadownloads/" has been chopped off as rewrite base.
 
#3
Update: thanks, got it to work by placing that rule in the rails context and forgetting about the .htaccess files

Perhaps it would be nice to be able to serve internal redirects for files that aren't in /public...
 
Last edited:
Top