Current time: 04-18-2014, 01:03 AM Hello There, Guest! (LoginRegister)

Post Reply 
Default Document
07-10-2007, 09:26 AM
Post: #1
Default Document
Newbie to DH here...

I want people to be able to automatically go to, say, myfirstpage.php when they browse http://www.mysite.com, without having to type in http://www.mysite.com/myfirstpage.php - in IIS they call this "Default Document". How can I do that?
Find all posts by this user
Quote this message in a reply
07-10-2007, 10:29 AM
Post: #2
Default Document
Is there some reason you don't want to just name the file index.php?

Free unique IP and $67 off with promo code FLENSFREEIP67 or use FLENS97 for $97 off. Click here for more options
Find all posts by this user
Quote this message in a reply
07-10-2007, 10:34 AM
Post: #3
Default Document
I actually figured it out.... I uploaded an .htaccess file to the root of the site with following line:
DirectoryIndex myfirstpage.php
Find all posts by this user
Quote this message in a reply
07-10-2007, 10:41 AM
Post: #4
Default Document
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.pl 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

--rlparker
Find all posts by this user
Quote this message in a reply
07-10-2007, 10:43 AM
Post: #5
Default Document
Ah, Good deal - it looks like you were posting while I was typing Wink .

I'm glad you got it sorted. Smile

--rlparker
Find all posts by this user
Quote this message in a reply
07-10-2007, 10:48 AM
Post: #6
Default Document
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 FLENSFREEIP67 or use FLENS97 for $97 off. Click here for more options
Find all posts by this user
Quote this message in a reply
07-10-2007, 11:30 AM
Post: #7
Default Document
Quote: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?
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 .

--rlparker
Find all posts by this user
Quote this message in a reply
07-10-2007, 01:24 PM
Post: #8
Default Document
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.
Find all posts by this user
Quote this message in a reply
07-10-2007, 01:27 PM
Post: #9
Default Document
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 FLENSFREEIP67 or use FLENS97 for $97 off. Click here for more options
Find all posts by this user
Quote this message in a reply
07-10-2007, 08:54 PM
Post: #10
Default Document
Well, it's index.htm, index.html, index.shtml and index.php.

Max discounts with E97 or O97 code. U will never find better one. Check it and U will see!
Webhosting infos, who sucks, who oversells?
Visit this user's website Find all posts by this user
Quote this message in a reply
Post Reply 


Forum Jump: