Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I installed XAMPP on my mac months ago and was working great.

Now i get "Test Page For Apache Installation" when i try to browse /localhost

and /localhost/xampp is not found.

But when i browse / it just works as localhost used to be.

I double checked my /etc/hosts file that i have localhost and not commented.

Also when i browse localhost/~username/test.php , i get contents of test.php:

<?php echo 'ganim'; ?>

but if i browse , i get:


what could change redirecting of localhost or how can i get localhost work again?

share|improve this question

migrated from Oct 20 '09 at 3:14

This question came from our site for professional and enthusiast programmers.

The 'Test Page for Apache installation' IS the webpage served when you access localhost, so that part's working. If that's not what you had before, something has changed the files in the document root. – pavium Oct 20 '09 at 2:48
I used to see XAMPP's orange page when i browse for localhost also i couldn't find the 'Test Page for Apache installation' file on hard drive and ist it weird that i have XAMPP's page on but i get 'Test Page for Apache installation' on localhost... – Ganim Oct 20 '09 at 3:09
up vote 1 down vote accepted

Maybe the OS X built-in web server is active and managed to bind to localhost, while XAMPP managed to bind to Try turning off Web Sharing in System Preferences and restart XAMPP.

share|improve this answer
That doesn't make much sense, since localhost= – Tarnay Kálmán Oct 20 '09 at 2:57
does /etc/hosts exist in Mac world? Cause you can change that definition – PostMan Oct 20 '09 at 3:01
Well, i didn't remember that i turned on Web Sharing, i turned it off and everything turned back to normal. Thanks. – user23416 Oct 20 '09 at 3:30
@Kalmi: Apparently it did make sense after all. :) Recently localhost tends to mean ::1 on Macs. – deceze Oct 20 '09 at 3:34

try to ping localhost, see if it maps to In my case, my Mac maps localhost to

share|improve this answer
That's actually not a good test because ping doesn't handle IPv6. You can try telnetting to localhost; at least in 10.6 I see it try ::1, then fe80::1, then finally – Nicholas Riley Oct 20 '09 at 3:01

localhost first tries the IPv6 localhost (::1) and you're probably not considering that in your Apache config. You can test by disabling IPv6 for the loopback interface:

% sudo ip6 -d lo0 
% ifconfig lo0
lo0: flags=8049<UP,LOOPBACK,RUNNING,MULTICAST> mtu 16384
    inet netmask 0xff000000

Then try localhost again; it should only be able to connect via IPv4. (Note that many Mac OS X features use IPv6, so this is not a long-term solution, just a diagnostic measure. You should fix your Apache configuration.)

share|improve this answer
I've comment ::1 localhost in /etc/hosts, it's now working ! – Fabien Sa Dec 19 '15 at 2:07
Keep in mind this may break a lot of other stuff, particularly in the future with more movement to IPv6. You should really fix the actual problem in your Apache configuration so it listens on v6 localhost. – Nicholas Riley Dec 19 '15 at 17:11

The reason this occurs is because of the way Mac handles urls. I'm assuming you want this to show up in Safari and that you want it enabled via Web Sharing preferences panel of the Preferences pane. If so do this.

1.) Verify that the following line is in /etc/hosts localhost

2.) Verify XAMPP is starting on port 80 or determine which port it is starting on and verify that you are looking at

Now comes the fun.. This looks like PHP so...

3.) Make sure the following line is enabled in /etc/apache2/httpd.conf (default it is)

LoadModule php5_module        libexec/apache2/

4.) Make sure that the users space area is enabled int /etc/apache2/httpd.conf

Include /private/etc/apache2/extra/httpd-userdir.conf

5.) Ensure that your username is listed /private/etc/apache2/users/*.conf There should be a file with your username in it. It should contain something like this..

<Directory "/Users/<username>/Sites/">
    Options Indexes MultiViews
    AllowOverride None
    Order allow,deny
    Allow from all

6.) Restart web sharing and go to http://localhost/~username


share|improve this answer

Your Answer


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