|
|
#1 (permalink) |
|
Registered User
Seasoned Poster
Joined in Aug 2004
Lives in Bangkok, Thailand
56 posts
Gave thanks: 1
Thanked 0 times
|
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> Last edited by kevin; April 29th, 2006 at 5:20 AM.. |
|
|
|
|
|
#2 (permalink) |
|
Registered User
Seasoned Poster
Joined in Aug 2004
Lives in Bangkok, Thailand
56 posts
Gave thanks: 1
Thanked 0 times
|
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> Last edited by kevin; April 29th, 2006 at 10:02 PM.. |
|
|
|