Jump to content

Recommended Posts

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

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

 

 

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.