All web servers are configured to display a default page for a directory if a default file exists. This is how your home page looks when someone simply enters a domain name for a website URL and the home page is displayed. A server is configured to search a list of default file names and if it finds a match, it displays the page. The default files might be similar to the ones shown below.

index.htm

index.html

index.shtml

index.php

When someone goes to your site by typing your URL, the index file is what they usually see first. This prevents you from seeing other pages or files that you may have in the root directory. What your visitor actually sees in this case is your home page.

The other directories (subfolders) on your website, the ones below your root directory, which are usually named “public” or “public_html”, typically do not have this index file. If the index page is not there, your visitor can see every web page or file you have in that directory. A folder without an index file is open and everyone can find your product if they search for it. Therefore, you must create an index page for all your folders.

You can check whether or not your site is configured to prevent directory listing. You can test this by entering your URL domain name and a directory name for any directory that exists on your site in your web browser (for example, URL/temp). Doing this should either generate a browser error page or list the contents of the directory.

Assuming you have a subdirectory named temp as in the example above, you’ll see the following if the directory listing is not avoided.

index / temperature

Name——Last Modified———-Size

Main directory——–30-Apr-2009 11:09— –

document1.txt———–29-Apr-2009 10:03— 20k

document2.pdf———–28-Apr-2009 06:10— 1831k

document3.doc———–27-Apr-2009 09:10— 568k

The above example shows the full directory listing of the folder named temp. All someone has to do is click on the file to open it and possibly modify it. They can also download any of the files in the directory. If you are in this situation, you should add some website protection to your subfolders.

So we see that if there is no index page on a server configured to avoid listings, an error is usually generated. But when a server is configured to allow directory listing, the directory index is displayed instead of generating an error.

The index page can be used in any directory on a website, except those directories that already use an index page or default page. This includes the root directory. Never put one of these files in the root directory, never overwrite an existing index page or default page, and never put an index page in a directory where another index page or default page already exists.

The subfolder index page doesn’t have to be anything special. It can be a very simple HTML page, since you are only using it to close the door on your folders. Below is a simple index page that you can use.

————————————————– —————–

————————————————– —————— The above would show a blank web page. Instead of seeing all the files you have in the temporary subfolder, they would just see a blank web page. If you want, you can put text or graphics between

</p> <p> and<br />

 

You can add some text that maybe says:

“Internal server error. Please contact your system administrator.”

The text will give the impression that the person trying to enter your site caused some sort of server error and will hopefully prevent them from continuing. The modified index page is shown below.

————————————————– ——————-

</p> <h1>Server error</h1> <p> Internal Server Error. Contact your system administrator.<br />

Leave a Reply

Your email address will not be published. Required fields are marked *