You are here: Re: Index.php does not open up « PHP Programming Language « IT news, forums, messages
Re: Index.php does not open up

Posted by Andrew DeFaria on 06/28/05 08:45

Jofio wrote:

> I have renamed index.html to indexHtml.html so to avoid the browser
> from opening the file by default at the launching of a browser.
> Instead I want wanted the index.php to open up by default....

What a browser opens as a default page is a function of what you tell
the browser to open as a default - not a function of the web server! My
default "home" page is set to http://defaria.com on the browser I run at
home - Firefox. At work it's set to http://news.google.com. Notice none
of these involve localhost!

> and oh yes, typing http://localhost/index.php does open the page.
> However, problem is it doesn't open up by default as it should like
> index.html.

You could always set your default home page to
http://localhost/index.php! ;-)

What is your default home page set to in your browser? For that matter
WHAT'S YOUR BROWSER! You neglected to mention that.

> Win XP pro is my OS.
>
> I've just uppended index.php in the DirectoryIndex line in the
> apache's httpd config file as shown below
>
> DirectoryIndex index.html index.php index.html.var

What's an "uppended"?!? 'Cause I see index.php between index.html and
index.html.var. Is that what "uppended" means? :-)

> ....don't seem to see any difference.

Did you follow the other advice to restart Apache? Changes to the config
will not go into effect until you do that. Also, is there an index.html
in your DocumentRoot?

> But nevertheless, thanks alot.

Again this is not rocket science here. If you specify http://localhost
in the address bar (or configure it for the default page to open for
your browser) then the web server at localhost (default port of 80) will
be contacted. The server will look at what DocumentRoot is set to (for
example, C:\HTDocs). Since you didn't specify an actual file then the
server will search for C:\HTDocs\index.html, because that is what you
listed first in DirectoryIndex. If that file is found it will be
retrieved - end of search. If not then the search continues to
C:\HTDocs\index.php. Assuming you've configured the type for .php files
to run through PHP it will be run through PHP and the resulting file
will be displayed. If C:\HTDocs\index.php is not found then
C:\HTDocs\index.html.var will be use if it is found. Finally, if none
are found then the server will return 404.
--
If love is blind, why is lingerie so popular?

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация