Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Opening localhost in the browser is pointing a local webpage (examplePage) after playing with some config files a while back, and I can't figure out how to restore the default behavior.

Background:

I have XAMPP installed on my Windows 7 machine, and a webpage at c:/xampp/htdocs/examplePage.

A couple weeks ago, I was on a mission to get sites root-relative urls (/resource) to work, so I played around with a bunch of apache/conf files, including httpd.conf and httpd-vhosts.conf and also was messing with the Windows hosts file. I gave up at some point, didn't document exactly what I did, and have since probably forgotten some of what I did.

Many of my changes stemmed from suggestions in this StackOverflow post

What I've Tried

  • I commented out my additions to the hosts file
  • I turned off XAMPP (thus hopefully negating any apache config file effect)
  • I reverted to my original DocumentRoot in httpd.conf anyway (xampp/htdocs)

localhost still displays examplePage. Even with xampp turned on (my reverted DocmentRootisn't taking effect)

Does anyone know what I may have done and how I can fix it?

Update : Its been resolved, thank everyone so much

  • in taskmanager, theres a couple instances of httpd.exe (Apache HTTP Server). I ended these, and opened XAMPP, restarting apache.
  • all references to examplePage in my .conf files that I could find had been commented out or removed. I imagine that the old versions were still in effect for some reason, and manually ending the Apache processes fixed this.

As a point of interest, Its still a mystery why those processes were running - I cannot reproduce that situation. I must've stumbled upon a XAMPP bug of some sort.

share|improve this question
    
Should we assume you mean you're trying to open localhost in a web browser? What are you expecting localhost to display? –  ernie Dec 13 '12 at 18:44
    
Yeah, not entirely sure what you're after here. My localhost is redirecting to a local webpage: isn't that expected functionality? When I make a HTTP request to my local webserver, I expect that it'll return a local response. Also, how did you manage to hijack your own machine? –  Naftuli Tzvi Kay Dec 13 '12 at 18:58
    
yes, sorry. I am opening it in a web-browser. –  Zach L Dec 13 '12 at 19:12
    
@TK Kocheran, the problem is that it is redirecting to a specific page, not the one I want. I cannot find how to revert whatever changed, so that I might use the conf files in XAMPP to point localhost where I want. –  Zach L Dec 13 '12 at 19:13
3  
Without seeing your conf files, this is very difficult to answer. This doesn't sound as if it has anything to do with your localhost settings. I'd suggest looking at the post you linked, and going backwards - check for aliases, check the DocumentDoot, check your vhost settings, etc. –  ernie Dec 13 '12 at 19:18

3 Answers 3

up vote 2 down vote accepted

As you mention you're able to load a page by accessing localhost in your browser, it sounds as if Apache is still running.

By extension, Apache is still running and most likely means that any changes to your httpd.conf have not been read or are being used.

Couple steps:

  1. Kill all your apache processes - you can try doing this by stopping XAMPP, but you may need to use Task Manager. Verify in Task Manager that no httpd.exe processes are running.
  2. Review your configuration - check for aliases, VirtualHosts, DocumentRoot, rewrite rules, .htaccess, etc. These are all items that could determine which page loads when you access localhost in a browser
  3. Finally, restart Apache (and/or XAMPP) - this will cause it to re-read all your conf files. In general, Apache must be restarted when httpd.conf or other conf files are updated.
share|improve this answer

Try uninstalling XAMMP along with deleting the Apache and MySQL services, then re-install.

Use the unistaller, then check your services to make sure Apache and Mysql are not there. If so, open up cmd and run the following to remove services sc delete ServiceName. Check services again, once you can confirm they are no longer there, proceed to install the latest version of XAMMP.

share|improve this answer
    
Who needs a fully working Windows anyways, just boot up a VM. –  bobthyasian Dec 13 '12 at 18:54
    
Giving this the check b/c its the closest to the actual solution. If you want to edit to reflect the specifics of my resolution, I'll be happy to give you a +1 as well. That said, if someone beats you to it, I may steal away that checkmark ;-) –  Zach L Dec 13 '12 at 20:18
    
@ZachL I'd suggest instead of re-installing, you actually go backwards and try and figure out what was happening. If the issue was strictly that you had extra services running, thus the changes to your httpd.conf weren't being used, then that should be the answer, not the idea of nuking and starting over. Marking this as an answer does a disservice to anyone who's actually experiencing a similar issue and searching for a solution. –  ernie Dec 13 '12 at 21:07
    
Agreed... checkmark removed... Feel free to create a more appropriate answer. I can do that myself - and will - but I prefer to give the internet points to one of you helpful folks who helped lead me to the solution –  Zach L Dec 13 '12 at 21:17
    
Thanks for the edit bob, have another upvote ;-) –  Zach L Dec 14 '12 at 14:24

in windows, inside the hosts file, change localhost value (after ident) to 127.0.0.1

share|improve this answer
3  
Since Windows 7, localhost is no longer defined in the hosts file: localhost name resolution is handled within DNS itself, see here –  Bob Dec 13 '12 at 18:44
    
@Bob thank you for the info! upvoted for helpfulness –  Lorenzo Von Matterhorn Dec 13 '12 at 18:53

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.