Jump to content

[SOLVED] Trying to restrict access to certain folders in server


Yesideez

Recommended Posts

My website has various files available for download but I only want to have those files accessible by scripts contained on the web server.

 

I've got an empty index.php inside each folder so people can't browse the files but what I'd like to do is have them get "Access denied" by Apache rather than empty space.

 

I borrowed a one liner from a friend's set-up which he uses to do exactly what I'm wanting to do:

deny from all

but this denies everything even if I try and download a file using the website so I then had a read up and came up with this:

Order Deny,Allow
Deny from all
Allow from www.pictureinthesky.net

Again, that denies everything access still.

 

This is a direct link to one of the files:

http://www.pictureinthesky.net/files/games/cfodder2.zip

 

I've managed to set up a rewrite rule to prevent hotlinking but can it also be made to prevent users typing the URL directly into the browser?

 

Any help gratefully appreciated!

Link to comment
Share on other sites

Now I'm not sure I understand what you mean - if they're inside their own folder then they're outside of the document root :/

 

Not if those folders are within the document_root. eg;

 

[pre]

/home

  |

  |

  _ /web_doc_root

    |

    |

    _ /dir1

    |

    |

    _ /dir2

[/pre]

 

The contents of /home are outside your web document root and therefore unreachable via the web, dir1 and dir2 however are not and all files within them are directly accessible via http://yourdomain/dir1/*.

Link to comment
Share on other sites

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.