Default Document

Newbie to DH here…

I want people to be able to automatically go to, say, myfirstpage.php when they browse, without having to type in - in IIS they call this “Default Document”. How can I do that?

Is there some reason you don’t want to just name the file index.php?

Free unique IP and $67 off with promo code [color=#CC0000]FLENSFREEIP67[/color] or use [color=#CC0000]FLENS97[/color] for $97 off. Click here for more options

I actually figured it out… I uploaded an .htaccess file to the root of the site with following line:
DirectoryIndex myfirstpage.php

If for some reason you don’t wish to use index.php for your “default page” as lensman correctly suggested, you have many other choices “pre-installed” on DreamHost’s apache servers.

Take a look at this DH Wiki Article on DH Apache Infrastructure, which includes, in part:

"The DirectoryIndex command lists all the files Apache should look for (in order) to determine what to display when somebody goes to a URL for a directory. That is, it’s the default file name for your web site. Ours is set to:

DirectoryIndex index.html index.shtml index.htm Index.html Index.htm Index.shtml default.htm Default.htm default.html Default.html default.shtml Default.shtml page1.html index.cgi index.php index.php3 index.phtml home.htm home.html home.shtml index.wml

As long as you name your “index” file any one of those things, it will work!

If you have two files with names from that list, Apache will show the one that shows up first (e.g. index.html will show up, even if you have an index.php file in the same directory).

You can change your own DirectoryIndex setting to be anything you’d like via an .htaccess file too! "

As you can see, you have lots of choices, and you can even set it to somethin entirely different if you want. :wink:


Ah, Good deal - it looks like you were posting while I was typing :wink: .

I’m glad you got it sorted. :slight_smile:


Does the DirectoryIndex command in your .htaccess file operate recursively on any subdirectories? For instance in the above example, will apache now only look for myfirstpage.php as the directory page for any subdirectory of the site unless overridden by another .htaccess file?

Apologies for the basic question…

Free unique IP and $67 off with promo code [color=#CC0000]FLENSFREEIP67[/color] or use [color=#CC0000]FLENS97[/color] for $97 off. Click here for more options

While I have not tested that specific example, that is my understanding; that is how .htaccess works.

He he, no need to apologize, and it is not that basic a question - you brought up a good point that the original poster should consider :wink: .


Actually, from my tests it appears that the DirectoryIndex setting is only valid for that location in your site structure. For example I have a subdirectory called “assets”. If i browse to that, it just lists the directory’s contents. I have to go to where the htaccess file is to be redirected to my “index” php page.

If you put a file named “myfirstpage.php” in the assets directory, does it display that?

Free unique IP and $67 off with promo code [color=#CC0000]FLENSFREEIP67[/color] or use [color=#CC0000]FLENS97[/color] for $97 off. Click here for more options

Well, it’s index.htm, index.html, index.shtml and index.php.

Max discounts with [color=#CC0000]E97[/color] or [color=#CC0000]O97[/color] code. U will never find better one. Check it and U will see!
Webhosting infos, who sucks, who oversells?