Jump to content

can't get my htaccess to work the way i want! - restricted access.


Recommended Posts

Hi all

 

I am really gonig mad trying this out, I have a folder which file uploads are in, and only want them to be downloadable via access from one php file, which also resides in the same folder. its a basic php forcedownload script. I dnot want the files to be able to be accessed by typing them into the browser (i have already hidden the file names, and added checks for logged users).

My efforts have seem to be all or nothing, i.e cant access anything in the folder or you can anything.

 

i had this in the top of the htaccess:

# disable directory browsing

Options All -Indexes

 

which wouldnt let me access the php script that downloads the files (the php download script is called by updating the src of an iframe via ajax, I am using an iframe hidden to trigger the force download)

 

if i delete the htacess it works fine but then no security.

 

I tried adding this to the htaccess and it didnt work either:

 

 

AuthUserFile /dev/null

AuthGroupFile /dev/null

 

RewriteEngine On

 

RewriteCond %{HTTP_REFERER} !^http://www.ethickink.co.uk/geoline/.* [NC]

RewriteCond %{HTTP_REFERER} !^http://ethickink.co.uk/geoline/.* [NC]

 

RewriteRule /* http://www.ethickink.co.uk/geoline/pages/index.html [R,L]

 

 

I really am not understanding htaccess very well  :'(

 

any help would be much appreciated

Options -Indexes will only disable directory browsing and Auth*File also requires other directives to work.

 

The easiest way with Apache is

Order allow,deny

(in the .htaccess in the folder) but that disables access to everything. Of course you could just move the download script somewhere else and keep the directory dedicated to file storage.

 

You can allow access to specific files though.

Order allow,deny

    Order deny,allow

or a wildcard


or something else.

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.