icon Get the most out of Surmunity, read our tips here! Need an interesting blog to read? You've got to read the Surpass Blog! | Welcome! Please register to access all of our features.

» Surpass Web Hosting Forums » Discussions » Coding and Programming » DirectoryIndex, Directory Index, default pages, page loading order

Reply
 
LinkBack Thread Tools Search this Thread Rate Thread
Old April 29th, 2006, 5:18 AM   #1 (permalink)
Registered User
Seasoned Poster
 
kevin's Avatar
 
Joined in Aug 2004
Lives in Bangkok, Thailand
56 posts
Gave thanks: 1
Thanked 0 times
Thumbs up DirectoryIndex, Directory Index, default pages, page loading order

This is not a question but a result of what I've found out by experimentation. I could not find the answer anywhere else in this forum so I thought I'd place it for others.

On a standard Surpass/Hostdime server pages load in a specific order when the URL ends in a '/'. That is: no specific page is given. Such as http://yourdomain.com or http://yourdomain.com/

The order is (first to last):

index.html
index.cgi
index.js
index.php
index.htm
default.htm
default.html

If the first page in the list does not exist the server goes on to try and find the next and so on down the list. If none of the pages exist then a standard directory listing is returned to the browser.
There may be some other default extensions as well (eg: .cfm) as I've not experimented with all extensions but .asp and .jpg in both index and default do not work. (see later for how to make them work).

Important things to remember:

A .cgi has to have execute permissions set on it or you'll get a 500 server error.
Be careful having index.php, index.htm, default.htm and default.html as your home page if you intend to also have a index.js file. The index.js file will load first. I found this out the hard way and broke my server for weeks until I renamed index.js to index1.js

The directory listing order is set by an apache file outside of your server space and you would have to contact support for any changes. There is however a way for you to do it within your server space. Default page listing can be ammended either in content or order. What you'll need to do is edit the .htaccess file. This file can be found in the root of your server (public_html) and is normally empty (0 bytes). If it doesn't exist you can always create one. It is a plain text file and should have a 644 attribute.

You can have a .htaccess file in each folder and any instructions in it will apply to that folder and folders down from it.

The command to add to the .htaccess file for index pages is:

DirectoryIndex first.page second.page

To repeat the standard order of page loading your .htaccess file should look like:

DirectoryIndex index.html index.cgi index.js index.php index.htm default.htm default.html

You can remove and add from this list as you please. For instance in my public_html/images folder I have a index.jpg file. I simply added index.jpg to the end of the DirectoryIndex list in a .htaccess file in that folder.



<keywords for forum searching>
DirectoryIndex
Directory Index
index.html index.cgi index.js index.php index.htm default.htm default.html
default pages
page loading order
.htaccess
<end of keywords>
__________________
http://www.a2zworldwideweb.com/
pass87.dizinc.com (66.7.201.232)

Last edited by kevin; April 29th, 2006 at 5:20 AM..
kevin is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old April 29th, 2006, 10:00 PM   #2 (permalink)
Registered User
Seasoned Poster
 
kevin's Avatar
 
Joined in Aug 2004
Lives in Bangkok, Thailand
56 posts
Gave thanks: 1
Thanked 0 times
Thumbs up I forgot one very important extension .shtml in the above message.

I forgot one very important extension .shtml in the above message.

So please ammend as follows:

The order is (first to last):

index.html
index.cgi
index.shtml
index.js
index.php
index.htm
default.htm
default.html


To repeat the standard order of page loading your .htaccess file should look like:

DirectoryIndex index.html index.cgi index.shtml index.js index.php index.htm default.htm default.html


<keywords for forum searching>
DirectoryIndex
Directory Index
index.html index.cgi index.shtml index.js index.php index.htm default.htm default.html
default pages
page loading order
.htaccess
<end of keywords>
__________________
http://www.a2zworldwideweb.com/
pass87.dizinc.com (66.7.201.232)

Last edited by kevin; April 29th, 2006 at 10:02 PM..
kevin is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On