5

I have installed XAMPP , there is a htdocs folder and inside it index.html file , when I try to open it in my browser through http://localhost/xampp/htdocs/index.html it says unable to connect to localhost .

what is wrong ?

Robert Harvey
  • 178,213
  • 47
  • 333
  • 501
user1841718
  • 187
  • 1
  • 4
  • 15

7 Answers7

9

instead of

 http://localhost/xampp/htdocs/index.html

try just

http://localhost/index.html

or if index.html is saved in a folder in htdocs then

http://localhost/<folder-name>/index.html
Shema_Thomas
  • 89
  • 1
  • 2
6

htdocs is your default document-root directory, so you have to use localhost/index.html to see that html file. In other words, localhost is mapped to xampp/htdocs, so index.html is at localhost itself. You can change the location of document root by modifying httpd.conf and restarting the server.

scohe001
  • 15,110
  • 2
  • 31
  • 51
Fr0g
  • 252
  • 1
  • 9
2

You need to start your Apache Server normally you should have an xampp icon in the info-section from the taskbar, with this tool you can start the apache server as wel as the mysql database (if you need it)

Nickolaus
  • 4,785
  • 4
  • 38
  • 60
2

Start your XAMPP server by using:

  • {XAMPP}\xampp-control.exe
  • {XAMPP}\apache_start.bat

Then you have to use the URI http://localhost/index.html because htdocs is the document root of the Apache server.

If you're getting redirected to http://localhost/xampp/*, then index.php located in the htdocs folder is the problem because index.php files have a higher priority than index.html files. You could temporarily rename index.php.

ComFreek
  • 29,044
  • 18
  • 104
  • 156
  • thank you , I do not see `apache_start.exe` but `apache_start.bat` and when run it , it waits a few seconds then says `apache is not started` , so what is problem – user1841718 Feb 26 '13 at 02:53
  • @user1841718 It's *\*.bat*, of course (corrected in answer now) ;) Are there any other messages? Does the window close immediately? Please check also whether any other program is using port 80. You can accomplish this by starting the control panel (*xampp-control.exe*) and clicking on the *Netstat* button. – ComFreek Feb 26 '13 at 13:58
  • I have checked the port 80 and it is free but still there is a problem , the apache service in my PC can not be started , what does this mean to you ? I have tryied to start the service from control panel in services but can not be started . – user1841718 Mar 03 '13 at 03:22
0

All created by user files saved in C:\xampp\htdocs directory by default, so no need to type the default path in a browser window, just type http://localhost/yourfilename.php or http://localhost/yourfoldername/yourfilename.php this will show you the content of your new page.

geisterfurz007
  • 5,292
  • 5
  • 33
  • 54
-1

You should simply create your own folder in htdocs and save your .html and .php files in it. An example is create a folder called myNewFolder directly in htdocs. Don't put it in index.html. Then save all your.html and .php files in it like this-> "localhost/myNewFolder/myFilename.html" or "localhost/myNewFolder/myFilename.php" I hope this helps.

Anne
  • 11
-1

I just put an index.html file in /htdocs and type in http://127.0.0.1/index.html - and up comes the html.

Add a folder "named Forum" and type in 127.0.0.1/forum/???.???

David
  • 1
  • 1
    This does not provide an answer to the question. You can [search for similar questions](//stackoverflow.com/search), or refer to the related and linked questions on the right-hand side of the page to find an answer. If you have a related but different question, [ask a new question](//stackoverflow.com/questions/ask), and include a link to this one to help provide context. See: [Ask questions, get answers, no distractions](//stackoverflow.com/tour) – geisterfurz007 Oct 17 '19 at 09:13