It is currently Sat Oct 05, 2024 4:21 am


All times are UTC




Post new topic Reply to topic  [ 1 post ] 

Do you find this article helpful?
Yes 100%  100%  [ 4 ]
No 0%  0%  [ 0 ]
Total votes : 4
Author Message
 Post subject: How to: Change the page that loads by default
PostPosted: Tue Jun 20, 2006 8:36 am 
Support Tech
Support Tech

Joined: Thu Mar 23, 2006 1:07 pm
Posts: 238
When someone opens your website the server automatically opens the "index" page - this is the default page. The server searches for an index page (and opens it) in the following order:
index.php
index.html
index.htm

This means that if there are all of the 3 files mentioned above, the server will open index.php. If there is no index.php the server will open index.html; if there is no index.html, the server will open index.htm and if there is no index.htm either the server will be display the directory index (list of the files in the folder).

So let's say you have index.php and index.html but you want index.html to load when someone opens the site and not index.php. How do you do this?
You use .htaccess. Add the following line to your .htaccess file (if you don't have one, create one):

Code:
DirectoryIndex index.html index.php


This will make the server try to open index.html first and if there is no such file, it will try to open index.php.

And what if you want the server to try to open the file warning.php first if there is no such file, you want it to try to open news.html? You use the following code:

Code:
DirectoryIndex warning.php news.html


Note that the DirectoryIndex directive works only with files which are in the same folder as the .htaccess file!

_________________
Cheers,
Steve
Support Team Supervisor

Before asking a question, please read the F.A.Q.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 1 post ] 

All times are UTC


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Jump to:  
cron
Hosting | Domains | Servers | Extras | Order | Support | Contacts | FreeHostia © 2011