Go Back   CodingForums.com > :: Server side development > Apache configuration

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 04-20-2009, 05:50 PM   PM User | #1
LordV
New to the CF scene

 
Join Date: Apr 2009
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
LordV is an unknown quantity at this point
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:
Quote:
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..
LordV is offline   Reply With Quote
Old 04-26-2009, 07:58 PM   PM User | #2
schleppel
Regular Coder

 
Join Date: Oct 2004
Posts: 330
Thanks: 0
Thanked 13 Times in 13 Posts
schleppel is an unknown quantity at this point
Try
Code:
<FilesMatch ".\.split$">
  Dent from all
</FilesMatch>
schleppel is offline   Reply With Quote
Old 04-27-2009, 03:59 PM   PM User | #3
LordV
New to the CF scene

 
Join Date: Apr 2009
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
LordV is an unknown quantity at this point
Hey,

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

Thanks!
LordV is offline   Reply With Quote
Reply

Bookmarks

Tags
htaccess, php

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 12:21 AM.


Advertisement
Log in to turn off these ads.