Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    New to the CF scene
    Join Date
    Apr 2009
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Smile htaccess deny all, allow php's readfile()

    Hey all,

    I'm trying to create a htaccess file that will do the following: it has to deny access to all .split files (located in subfolders). In addition it will allow the 'dl.php' file to read the .split files (php's readfile() function (or fopen() or ...)).

    The folder structure:
    Code:
    something
       | -- .htaccess
       | -- dl.php
       |
       | -- example1
       |  | -- 0.split
       |  | -- 1.split
       |  ` -- 2.split
       |
       | -- example2
          | -- 0.split
          | -- 1.split
          ` -- 2.split
    At this site (askapache.com) I found this snippet:
    Deny access to anything in a subfolder except php fopen
    This can be very handy if you want to serve media files or special downloads but only through a php proxy script.
    Code:
    RewriteEngine On
    RewriteBase /
    RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /([^/]+)/.*\ HTTP [NC]
    RewriteRule .* - [F,L]
    but I'm new to htaccess (and regexp ) so I've no clue how to edit the script so It'll work (I tried).


    Thanks in advance.

    Edit: I forgot to tell, anyone should be able to access the dl.php file...!
    Last edited by LordV; 04-20-2009 at 06:22 PM.

  • #2
    Regular Coder
    Join Date
    Oct 2004
    Posts
    363
    Thanks
    0
    Thanked 18 Times in 18 Posts
    Try
    Code:
    <FilesMatch ".\.split$">
      Dent from all
    </FilesMatch>

  • #3
    New to the CF scene
    Join Date
    Apr 2009
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Hey,

    Suppose it's 'deny' instead of 'dent'? At any rate, it worked! Perfect. And so simple...

    Thanks!


  •  

    Tags for this Thread

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •