Click to See Complete Forum and Search --> : .htaccess to limit file access - APACHE


discorax
09-17-2007, 02:14 PM
I'm looking for a code snippit to allow access into a folder ONLY through a webpage.

I have, what is essentially, a flash gallery and I'd like the photos/videos to only be accessible if requested from the flash.

Does anyone have a good understanding of APACHE and/or a sample of how to do this. I'm assuming it's a fairly simple task, I'm just not familiar enough with APACHE to do it.

Thanks in advance.
Ryan

LeeU
09-17-2007, 04:47 PM
This should help you <from: http://perishablepress.com/press/2006/01/10/stupid-htaccess-tricks/>:

Prevent Unauthorized Directory Browsing [ ^ ]

Prevent unauthorized directory browsing by instructing the server to serve a “xxx Forbidden - Authorization Required” message for any request to view a directory. For example, if your site is missing it’s default index page, everything within the root of your site will be accessible to all visitors. To prevent this, include the following htaccess rule:

# disable directory browsing
Options All -Indexes

Conversely, to enable directory browsing, use the following directive:

# enable directory browsing
Options All +Indexes

Likewise, this rule will prevent the server from listing directory contents:

# prevent folder listing
IndexIgnore *

And, finally, the IndexIgnore directive may be used to prevent the display of select file types:

# prevent display of select file types
IndexIgnore *.wmv *.mp4 *.avi *.etc