Location, Location, Location: Tips for Storing Web Site Files
Subject:   Use NetInfo Manager instead of /etc/hosts and other comments
Date:   2003-05-17 15:34:05
From:   maarky
For me it's easier to open NetInfo Manager rather that looking for a hidden file. So instead of directly editing your /etc/hosts file you can go to /Applications/Utilities/NetInfo Manager

Once you launch NetInfo Manager you will click on "machines" and then "localhost". Now you want to click on the lock in the bottom left corner so that you can edit the info (must be an admin user). Now duplicate "localhost" and rename the duplicate whatever you want your virtual host to be named. So for instance, you change "localhost copy" to "".

Now deselect your new machine by clicking on another one. It will ask you if you really want to make the change. Say yes. There you go.

Another thing. I don't know the wisdom of this but I got it from the apache documentation ( ) and I have had no issues with it. You do not need to specify in your virtual host directives. All you need is "*". For example, the following should work just fine:

NameVirtualHost *

<VirtualHost *>
DocumentRoot /Users/patrick/Documents/Projects/iCalShare/wwwroot

You can also add other directives inside your virtual host directive. For example, do you want each of your virtual hosts to have its own php include path? Do you want to add a domain specific alias? If so do this:

<VirtualHost *>
DocumentRoot /Users/patrick/Documents/Projects/iCalShare/wwwroot
<IfModule mod_php4.c>
php_value include_path "Users/patrick/Documents/Projects/iCalShare/"
Alias /manual/ "/Library/WebServer/Documents/manual/"
<Directory "/Library/WebServer/Documents/manual">
Options FollowSymlinks MultiViews
AllowOverride None
Order allow,deny
Allow from all

There's plenty of other stuff you can put in there too.

I have also noticed that with these virtual hosts they are case sensitive. Taking the above example, "" will work, but "" will not. Also, if you name you virtual host "php.mac" then "http://php.mac" will work, but "http://www.php.mac" will not. But if you name your virtual host "www.php.mac" then the opposite is true.

As a side note I have gone kinda crazy with virtual hosts since getting os x. I downloaded the PHP documentation Web pages and made a virtual host for that and the same for mysql documentation, phpmyadmin and so on. The convention I have used for tld's is .mac There is no .mac tld so I don't have to worry about it conflicting with real domains. So, if I want my php documentation I go to "http://php.mac"

1 to 1 of 1
  1. Re: Use NetInfo Manager instead of /etc/hosts and other comments
    2003-05-19 14:10:10  icalshare [View]

    • Re: Use NetInfo Manager instead of /etc/hosts and other comments
      2003-05-20 16:28:39  maarky [View]

      • Re: Use NetInfo Manager instead of /etc/hosts and other comments
        2003-05-23 12:39:31  anonymous2 [View]

1 to 1 of 1