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