Results 1 to 18 of 18

Thread: [RESOLVED] Replace the default page in http://localhost

  1. #1

    Thread Starter
    Frenzied Member mar_zim's Avatar
    Join Date
    Feb 2004
    Location
    Toledo Cebu City.
    Posts
    1,416

    Resolved [RESOLVED] Replace the default page in http://localhost

    I have installed apache web server successfully and seeing the page notifying that installation of the Apache web server software on this system was successful...blah.blah..

    What I want to achieve is that replace that page.
    i.e When I type in a web browser http://localhost it will load another page not the page of confirmation about apache installation. How to do that?


    thanks in advance.

  2. #2
    I'm about to be a PowerPoster!
    Join Date
    Jan 2005
    Location
    Everywhere
    Posts
    13,647

    Re: Replace the default page in http://localhost

    The directory index page is determined by a list of possible file names which Apache searches for one by one. I believe it goes something like

    index.php,index.html,index.htm ... etc.

    so you need to replace the one that's currently being displayed, with your own. Unless you've configured it differently the default base directory is /htdocs so look for the files in there.

  3. #3

    Thread Starter
    Frenzied Member mar_zim's Avatar
    Join Date
    Feb 2004
    Location
    Toledo Cebu City.
    Posts
    1,416

    Re: Replace the default page in http://localhost

    What do you mean?
    I've look through the httpd.default.conf file and found the DirectoryIndex index.html index.html.var and change it to DirectoryIndex index.php then restart the web server but still it display the default one not the file I created(index.php).

  4. #4
    I'm about to be a PowerPoster!
    Join Date
    Jan 2005
    Location
    Everywhere
    Posts
    13,647

    Re: Replace the default page in http://localhost

    If you have a .htaccess file in any directory, that will override any .htaccess file in any higher level directory, which override any config files. So put the DirectoryIndex line in the .htaccess file and then your index.php file should be selected.

    (Sorry, meant to post this earlier but forgot about it)

  5. #5

    Thread Starter
    Frenzied Member mar_zim's Avatar
    Join Date
    Feb 2004
    Location
    Toledo Cebu City.
    Posts
    1,416

    Re: Replace the default page in http://localhost

    I've searched about htaccess file and come up htaccess.html? Is that file what you mean? If it is then I put the directoryindex line in that file considering the index.php selected but still it wont work.

    I'm really lost.

  6. #6
    I'm about to be a PowerPoster!
    Join Date
    Jan 2005
    Location
    Everywhere
    Posts
    13,647

    Re: Replace the default page in http://localhost

    No its supposed to be called ".htaccess". Are you viewing it through a Unix shell or FTP? If so then it will be hidden (because of the starting dot). You need to either turn on showing hidden files (somehow) or just upload a file called ".htaccess" and overwrite it.

  7. #7

    Thread Starter
    Frenzied Member mar_zim's Avatar
    Join Date
    Feb 2004
    Location
    Toledo Cebu City.
    Posts
    1,416

    Re: Replace the default page in http://localhost

    Pen can I create an .htaccess file in htdocs directory and put the line directoryindex index.php?

  8. #8

    Thread Starter
    Frenzied Member mar_zim's Avatar
    Join Date
    Feb 2004
    Location
    Toledo Cebu City.
    Posts
    1,416

    Re: Replace the default page in http://localhost

    or If I will create an .htaccess file what directory should I save it?

  9. #9
    I'm about to be a PowerPoster!
    Join Date
    Jan 2005
    Location
    Everywhere
    Posts
    13,647

    Re: Replace the default page in http://localhost

    In the directory where your file is going to be. .htacess files affect the directory they're in and all directories inside that one (unless overriden by another in a subdirectory).

  10. #10
    VBA Nutter visualAd's Avatar
    Join Date
    Apr 2002
    Location
    Ickenham, UK
    Posts
    4,906

    Re: Replace the default page in http://localhost

    Delete all the files from c:\program files\apache group\apache2\htdocs except index.php; that worked for me.
    PHP || MySql || Apache || Get Firefox || OpenOffice.org || Click || Slap ILMV || 1337 c0d || GotoMyPc For FREE! Part 1, Part 2

    | PHP Session --> Database Handler * Custom Error Handler * Installing PHP * HTML Form Handler * PHP 5 OOP * Using XML * Ajax * Xslt | VB6 Winsock - HTTP POST / GET * Winsock - HTTP File Upload

    Latest quote: crptcblade - VB6 executables can't be decompiled, only disassembled. And the disassembled code is even less useful than I am.

    Random VisualAd: Blog - Latest Post: When the Internet becomes Electricity!!


    Spread happiness and joy. Rate good posts.

  11. #11

    Thread Starter
    Frenzied Member mar_zim's Avatar
    Join Date
    Feb 2004
    Location
    Toledo Cebu City.
    Posts
    1,416

    Re: Replace the default page in http://localhost

    I've read a lot of pages discussing about .htaccess file. I've come up making an .htaccess file and the content is just a single line which is directoryindex index.php and save it in htdocs directory. Restart the apache server then access the localhost then viola it wont work. same page loaded the default page.

    *now I have a heavy heart*

  12. #12
    I'm about to be a PowerPoster!
    Join Date
    Jan 2005
    Location
    Everywhere
    Posts
    13,647

    Re: Replace the default page in http://localhost

    Do you have PHP installed and configured properly? If you go to localhost/index.php does it work?

    and was it DirectoryIndex not directoryindex? It's case sensitive I think.

  13. #13

    Thread Starter
    Frenzied Member mar_zim's Avatar
    Join Date
    Feb 2004
    Location
    Toledo Cebu City.
    Posts
    1,416

    Re: Replace the default page in http://localhost

    Yeah I've installed it properly no worries running localhost/index.php.

    I've also write it in correct case. DirectoryIndex index.php

  14. #14
    VBA Nutter visualAd's Avatar
    Join Date
    Apr 2002
    Location
    Ickenham, UK
    Posts
    4,906

    Re: Replace the default page in http://localhost

    Have you tried Cntrl+F5?
    PHP || MySql || Apache || Get Firefox || OpenOffice.org || Click || Slap ILMV || 1337 c0d || GotoMyPc For FREE! Part 1, Part 2

    | PHP Session --> Database Handler * Custom Error Handler * Installing PHP * HTML Form Handler * PHP 5 OOP * Using XML * Ajax * Xslt | VB6 Winsock - HTTP POST / GET * Winsock - HTTP File Upload

    Latest quote: crptcblade - VB6 executables can't be decompiled, only disassembled. And the disassembled code is even less useful than I am.

    Random VisualAd: Blog - Latest Post: When the Internet becomes Electricity!!


    Spread happiness and joy. Rate good posts.

  15. #15

    Thread Starter
    Frenzied Member mar_zim's Avatar
    Join Date
    Feb 2004
    Location
    Toledo Cebu City.
    Posts
    1,416

    Re: Replace the default page in http://localhost

    Quote Originally Posted by visualAd
    Have you tried Cntrl+F5?
    Good cntrl+f5 do the trick.

    and oh I deleted the .htaccess file and still it works. why?

  16. #16
    I'm about to be a PowerPoster!
    Join Date
    Jan 2005
    Location
    Everywhere
    Posts
    13,647

    Re: Replace the default page in http://localhost

    What you had in it is the default.

  17. #17

    Thread Starter
    Frenzied Member mar_zim's Avatar
    Join Date
    Feb 2004
    Location
    Toledo Cebu City.
    Posts
    1,416

    Re: Replace the default page in http://localhost

    So you could change the default page w/out the use of .htaccess file?

  18. #18
    I'm about to be a PowerPoster!
    Join Date
    Jan 2005
    Location
    Everywhere
    Posts
    13,647

    Re: Replace the default page in http://localhost

    Yea, it's just better to use a htacess file as otherwise you affect the entire site and that's not something you usually do in a hosted situation. If you're hosting yourself then no problems.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width