PDA

View Full Version : remove treeview display on root folder?


kevininpsu
01-23-2006, 12:59 PM
I need to hide contents of a web folder.

Currently if someone visits the root folder:
example: www.example.com/sensitiveinfo

the person would see the contents of 'sensitiveinfo' folder. Is there a way to hide this? Thanks in advance!

Masterslave
01-23-2006, 02:26 PM
404 :confused:

Pennimus
01-23-2006, 02:28 PM
The contents of a folder are generally displayed when their is no default page to go to at that level of the site.

You can define this in a .htaccess file uploaded to the directory in question. Add this to the .htaccess file -

DirectoryIndex whatever.html

The obvious aplication of this is to automatically point any direct access of the directory to your sites homepage.

DirectoryIndex http://www.whatever.com

- Adam

(PS : You may also want to reconsider your hosting plan... a good webhost blocks direct access to directories automatically)

kevininpsu
01-23-2006, 09:32 PM
I added a 'main.htaccess' which only contains the text:
DirectoryIndex whatever.html

I put it inside the folder in question.

This does not automatically load when i visit this directory. It still shows content of directory. Did I leave something out?

mark87
01-23-2006, 10:13 PM
It needs to be called .htaccess - it can't be called anything else!

kevininpsu
01-23-2006, 10:37 PM
hmmm '.htaccess' is telling me invalid filename

mark87
01-23-2006, 10:39 PM
What's telling you that, Windows?

Open Notepad, type in DirectoryIndex whatever.html, Save As... all file types - enter in .htaccess, should work.

kevininpsu
01-23-2006, 11:01 PM
553-The name you specified is not allowed.
553-Names must contain only ASCII letters (a-z,A-Z), digits (0-9), underscore, dot and dash.
553-Names must not start with a dot (.) or dash (-).
553-For additional info please visit:
553-See http://help.yahoo.com/help/us/webhosting/gftp/

I may have to switch from yahoo?

mark87
01-23-2006, 11:27 PM
Ah, yes, free hosts (and some paid hosts?) normally do not allow .htaccess.

kevininpsu
01-25-2006, 06:54 AM
ha it was very simple I uploaded a blank index.html and no more treeview structure when i visit the root folder. :cool:

Pennimus
01-25-2006, 09:17 AM
Well yes you could do that, and I suppose if you only expect malicious users to try and access the root it works. But for anyone who arrives there inadvertently a blank page isn't exactly the most user friendly.

fmx
01-25-2006, 12:20 PM
maybe you would like to add a meta refresh tag and/or a simple link to your blank index.html.
<meta http-equiv="Refresh" content="4;url=http://www.domain.com/other.html">