localhost sub-domains not working

Problems with the Mac OS X version of XAMPP, questions, comments, and anything related.

localhost sub-domains not working

Postby brickie » 11. March 2012 16:40

I have XAMPP 1.7.7 installed and working perfectly on Windows XP. I now need to get XAMPP Mac OS X 1.7.3 working on OS X 10.6.8.
Having installed it and displayed the XAMPP welcome screen I created a folder /Applications/XAMPP/htdocs/MyWebsites and in this created two more folders, Website1 and Website2. In these three new folders I placed simple 'index.html' files, each one containing text to announce the name of its parent folder.
As root I added two lines to the end of /private/etc/hosts to read:
Code: Select all
127.0.0.1   localhost
255.255.255.255   broadcasthost
::1             localhost
fe80::1%lo0   localhost

127.0.0.1    Website1.localhost
127.0.0.1    Website2.localhost


I then edited /Applications/XAMPP/etc/extra/httpd-vhosts.conf to read:

Code: Select all
NameVirtualHost *:80

<VirtualHost *:80>
   ServerName localhost
   DocumentRoot "/Applications/XAMPP/htdocs/MyWebsites/"
</VirtualHost>
   
<VirtualHost *:80>
   ServerName Website1.localhost
   DocumentRoot "/Applications/XAMPP/htdocs/MyWebsites/Website1"
/VirtualHost>

<VirtualHost *:80>
   ServerName Website2.localhost
   DocumentRoot "/Applications/XAMPP/htdocs/MyWebsites/Website2"
/VirtualHost>


I re-started Apache then typed 'http://localhost' into the browser. The index.html file from the 'MyWebsites' folder was displayed as expected.
I then tried 'http://Website1.localhost' with the result 'Server not found'. The same for Website2.
The alternative url format of 'http://localhost/Website1' correctly displayed the index.html file from the Website1 folder.
I then installed a multi-page website to the Website1 folder. The 'http://Website1.localhost' url format still failed, but 'http://localhost/Website1' correctly displayed the home page.
However, other pages of the site fail to display.

What must I do to get the 'http://Website1.localhost' url format working and to be able to display pages other than 'Home'.

Thanks,
brickie
brickie
 
Posts: 2
Joined: 11. March 2012 13:54
XAMPP Version: 1.8.3-2
Operating System: OS x 10.6.8 Snow Leopard

Re: localhost sub-domains not working

Postby DHH » 16. March 2012 08:29

One thing I would try, is too always remember the trailing slash for "DocumentRoot". Try that, and see if it shouldn't work. You'r clear otherwise from my opinion.
DHH
 
Posts: 1
Joined: 16. March 2012 08:27
Location: Denmark
XAMPP Version: 5.6.3
Operating System: Mac OS X

Re: localhost sub-domains not working

Postby brickie » 17. March 2012 21:56

Thanks for the reply DHH.

I added the trailing slashes as you suggested, but this made no difference.

Does anyone have any other suggestions?

Thanks,

brickie
brickie
 
Posts: 2
Joined: 11. March 2012 13:54
XAMPP Version: 1.8.3-2
Operating System: OS x 10.6.8 Snow Leopard

Re: localhost sub-domains not working

Postby underscore_05 » 26. May 2012 09:46

I dont know the right term but I already do what you've done and I always type it i terminal after i made some changes in host file

dscacheutil -flushcache

Im using Xampp 1.7.3, Mac OSX 10.6.8
underscore_05
 
Posts: 2
Joined: 26. May 2012 09:42
XAMPP Version: 1.8.3-2
Operating System: Mac OSX Snow Leopard


Return to XAMPP for Mac OS X

Who is online

Users browsing this forum: No registered users and 1 guest