Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialJohn Sanchez
iOS Development Techdegree Student 2,401 Points"localhost" url doesn't bring me to htdocs folder
While a couple minutes ago I was happily programming in php, all of a sudden when I pressed the refresh button I got an error : Not Found The requested URL /MAMP/contact.php was not found on this server. This was in place of contact.php. When I redirected the browser to localhost, the page said: Index of/ ... and then a list of files. I realized these files are the files located in my WebServer/Documents folder. This would mean localhost looks for files in this Documents folder instead of it the htdocs folder. It was working fine a short while ago.... Any help is appreciated. Thanks!
- John
5 Answers
Dan Ridley
Courses Plus Student 14,839 PointsHey John Sanchez ,
I am sorry you are having a problem.
Let me tag Randy Hoyt for us to try and help us solve this problem for you.
Randy Hoyt
Treehouse Guest TeacherWhat happens when you go to [http://localhost/MAMP/]?
John Locke
15,479 PointsYou might have to listen on a different port, sometimes applications such as Skype take up the default Port 80.
John Sanchez
iOS Development Techdegree Student 2,401 PointsWhen I go to [http://localhost/MAMP/], I get the same error.
Randy Hoyt
Treehouse Guest TeacherIt sounds like http://localhost/MAMP/ is pointing at your htdocs directory. It also sounds like you have an error in your PHP file. If there's an error and nothing output gets sent to the browser, then the browser will respond with that error. In your contact.php file, type something like "Hello?" at the very top (before the first opening PHP tag) and then visit [http://localhost/MAMP/contact.php]. Does the browser display the message?
John Sanchez
iOS Development Techdegree Student 2,401 PointsNothing happens...I get the error: Not Found The requested URL /contact.php was not found on this server.
Randy Hoyt
Treehouse Guest TeacherWhich address are you looking at?
Can you try both of them (with that "Hello" message in it)? I can't quite tell what's going on, but I think the first one will work.
If neither of them work, can you create a new file in your htdocs directory named [test.html], put text like "Hello?" in it, and then try each of these?
Nicholas Wadsworth
753 PointsI'm having the same problem. Only the http://localhost/contact.php address seems to be working.
John Sanchez
iOS Development Techdegree Student 2,401 PointsType in http://localhost:8888 instead.