How To Change The Index Page Default File Name of a Website
Wednesday, December 17th, 2008When you access a website home page (e.g. www.setforever.org) or a folder on the website (e.g. www.setforever.org/forums) there is a file that will serve the home page or the folder. Basically a file needs to be there to serve you a page at the web addresses.
Usually the page is a file called index.htm (HTML), index.html (HTML), index.asp(ACTIVE SERVER PAGE), index.php (PHP), or some other default file name (the bit before the dot) and a a file extension (the bit after the dot).
If your host is good at setting up servers then their settings will look for each of the file names and extensions in an order to see if the file exists to server to the person browsing the home page or the folder of the site. For example, your host may have configured your server to look for index.htm first and if that is not there then index.html and if that is not there then index.php, and so on.
However there may be instances when you need to change what is “looked for” first by your server, such as ina recent situation where I was developing a site for GD Tech UK Ltd (GDTECHUK)as their odl site stopped working and their website designder simply did not get it back up and running to server their business.
GDTECHUK’s home page was served by a file called index.html which simply references a flash animation and this animation had a link at the end if it with a “Enter Site” link which was linked to a file called index.php which was the start of the main commerce site.
I created the main commerce site in a folder called “shop” because it’s good to have folder and file names of what the site is about to help get better results for search engine searches.
When accessing the home page (www.gdtechuk.com) you should obviously get the flash movie which then links to the main commerce site (www.gdtechuk.com/index.php) but my created commerce site was at a different address (www.gdtechuk.com/shop).
My server’s default setting was to look for an index.php file for the home page (or any other folder page). So if I renamed the home page flash animation file from index.html to index.php this would have worked to get the animation to appear when you accessed the home page, but as the “Enter Site” link in the flash animation linked to a file called index.php, the animation would have effectively linked to itself and the user would never get to the main commerce site.
So, I had to find a way to use the index.html file as the home page to play the flash animation and then link to index.php file which I could re-direct to the /shop/ folder where the main commerce site is.
The way to do this is to override the server’s settings which have the order of the file names (and their extensions) to look for as the home page of a site or a folder on the site.
The way I did this was to created a file called .htaccess with the following line in it:
DirectoryIndex index.htm index.php
This file was then saved on the server’s home page directory to tell the server to look for a file called index.htm first and then a file called index.php next to create the home page.
As the flash movie was embedded in a the file called index.htm - this is what you see when you access the home page (www.gdtechuk.com) and in effect the server never gets to the option of looking for the second file type (index.php) as index.htm exists.
Now, when the flash movie ends and has the link to “Enter Site”, this link goes to the index.php file (which otherwise would have been looked for first by the default server setting) and this index.php will simply redirect you to the /shop/ directory which has the main commerce site.
Hwy did I have to go through all this and why didn’t we just simply change the link from the “Enter Site” button in the flash animation. The answer is that the client did not have the source file for the flash movie to be able to edit it so we effectively had to work with what we had.
The lesson for you is to always have the source of anything that you create so that you can change the outcome, otherwise it may cause such management difficulties in future.


