doubledee Posted August 13, 2011 Share Posted August 13, 2011 I develop in NetBeans which has a separate folder for each project, and thus has a different Web Root than my production server with GoDaddy. To address the different paths, I set up absolute paths using constants like ROOT and WEB_ROOT. Things have worked great until I introduced a mod_rewrite last week. With the new problems the mod_rewrite introduced, it was recommended to me that using "Virtual Hosts" would be much easier. So I just set up a "Virtual Host" on MAMP on my MacBook this morning, but am unsure what it is doing? Here is what I have... httpd.conf # Added on 2011-08-13 <VirtualHost *:80> DocumentRoot /Applications/MAMP/htdocs ServerName localhost </VirtualHost> <VirtualHost *:80> DocumentRoot "/Users/user1/Documents/DEV/++htdocs/01_MyProject" ServerName dev </VirtualHost> <VirtualHost *:80> DocumentRoot "/Users/user1/Documents/DEV/++htdocs/00_AAA" ServerName testvh </VirtualHost> When I type http:// dev/ it takes me to the index.php file in my 01_MyProject folder in NetBeans. But when I type http:// testvh/ it takes me to www. testvh.com ?! And any name I try to use for a 2nd Virtual Host name does a similar thing. I restarted MAMP but the problem exists. I am not even certain that I understand what the Virtual Host is doing... Can someone help me get all of this figured out and working?! :-\ Thanks, Debbie Link to comment https://forums.phpfreaks.com/topic/244705-php-and-virtual-hosts/ Share on other sites More sharing options...
jcbones Posted August 13, 2011 Share Posted August 13, 2011 You will most likely have to modify the `hosts` file on your computer. Here is a tutorial on how to do that: http://support.apple.com/kb/TA27291 Here is why you have to do that: Scroll to Resolving DNS issue Link to comment https://forums.phpfreaks.com/topic/244705-php-and-virtual-hosts/#findComment-1256905 Share on other sites More sharing options...
doubledee Posted August 14, 2011 Author Share Posted August 14, 2011 You will most likely have to modify the `hosts` file on your computer. Here is a tutorial on how to do that: http://support.apple.com/kb/TA27291 Here is why you have to do that: Scroll to Resolving DNS issue That was the problem... I forgot to adjust my Macintosh HD: private: etc: hosts file after I changed the name of my Virtual Host. Thanks, Debbie Link to comment https://forums.phpfreaks.com/topic/244705-php-and-virtual-hosts/#findComment-1257209 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.