PDA

View Full Version : Apache Server - How to stop people browsing folders?


Uzair
06-08-2009, 07:36 AM
Hi,

I have a website where I have many folder to keep my work. I have linked some URLs to that folder & that should be open only when somebody clicks on the URL.

The problem is....
When I directly put the folder name, it opens. I do not want it to be password protected. But I want people to access the files only by clicking the URL, not by entering the folder name in the URL bar.

For example...

I am sending people to this URL...
http://www.domainname.com/abcdefgh/xyz/
This opens the required page.

But if someone removes the xyz/ thing from the address bar & then presses ENTER, server shows a list of directy...

Index of /abcdefgh
- Parent directory
- zyx

etc. etc.

I do not want people to see this INDEX thing...

Please guide me how can do this?

timgolding
06-08-2009, 10:32 AM
You can turn directory listing off with htaccess. It would stop users seeing the list by typing in the folder url. However it wouldn't completely restrict access to the files to url links only. To do that you would have to completely block all access to the folder and use another url to access the required file and display through a url query string or the likes.

To turn off directory Listing create an .htaccess file in the folder

Options -Indexes


with the above code.
To completely restrict access to non links tell me what server side scripting language you are using.