Jump to content

Restrict Access To Folders from non authenticated users


cksraj

Recommended Posts

I've a folder which holds image (.gif/.jpg) files. the folder has been given --rwe-- permission to get the URL access. However, this allows unauthorized persons to access the images directly from the URL, the following proposed solution does not work:

 

1. putting the image folder outside my root directory - i don't have access to the root directory

 

2. having <directory> read and write </directory> permission, but does not work - it blocks php script to execute.

 

Can anyone suggest me the solution for my problem?

 

Problems:

1. I should have images access only to the PHP scripts and authenticated users.

2. Restrict the direct access to the images (by non authenticated users)

 

Thanks

Crew Kasy Raj

Link to comment
Share on other sites

You might have to password protect the directory or alternatively you can write a crazy little thing with .htaccess which will grab the path.. and pass it into a PHP script which will check if the user is authenticated (im assuming you are talking about PHP sessions etc) and if they are autenticated give them the image otherwise give a 404..

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.