blocking access to files and ORG_REQ_URI

Discussion in 'Ruby/Rails' started by tatsuhi, Jun 19, 2008.

  1. tatsuhi

    tatsuhi New Member

    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
  2. mistwang

    mistwang LiteSpeed Staff

    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. tatsuhi

    tatsuhi New Member

    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: Jun 21, 2008
  4. mistwang

    mistwang LiteSpeed Staff

    Should not be a problem, just define a "static" context pointing to a directory anywhere you want. It is just like Apache's "Alias" directive.

Share This Page