Loans - Free Myspace Layouts - Cheap Magazines - Coin Community - Mortgages

PDA

View Full Version : Problem with Virtualhosts


beniwtv
May 3rd 2006, 3:00 am
Hi. I'm having trouble with this virtualhost configuration:

<VirtualHost *:80>
DocumentRoot /home/xxx/rewrite/www
ServerName benito.xxx.com
ServerAlias *.benito.xxx.com
</VirtualHost>

<VirtualHost *:80>
DocumentRoot /home/xxx/www/beni
ServerName xxx.com
ServerAlias *.xxx.com
</VirtualHost>

<VirtualHost *:80>
DocumentRoot /home/xxx/www/beni
ServerName info.xxx.com
ServerAlias *.info.xxx.com
</VirtualHost>

Let me explain: both xxx.com and info.xxx.com are sites that are located in the same directory, in fact, they're the same site. benito.xxx.com is located in another directory with a file called content.php and .htaccess in it, that, basically do the following: you enter benito.xxx.com/Directory/foo/bar and it will redirect to content.php?Path=foo/bar. This works fine.

But now, if I am trying to access the other sites on certain directories, for example, info.xxx.com, apache will use benito.xxx.com instead. I don't know why. Hint: I am using Apache 2.

Thanks for any help,
beni

theblight
May 3rd 2006, 5:48 am
Try to check your DNS configuration and try to clear your browser cache and let me know the results

Hope it Helps

beniwtv
May 3rd 2006, 7:55 am
I've found out what my problem is. In xxx.com and info.xxx.com some pages use the php file_get_contents on localhost. Since Apache don't knows about localhost, it uses the first directive. As a result, the pages won't work because the files aren't there (remember that we have different DocumentRoots).

So, what I need now is to tell apache that localhost goes to the directory from xxx.com or info.xxx.com. How can I do that?

Thanks.

theblight
May 3rd 2006, 8:05 am
<VirtualHost 127.0.0.1:80>
......
</VirtualHost>

or

<VirtualHost localhost:80>
......
</VirtualHost>

beniwtv
May 3rd 2006, 8:20 am
Yes, thank you! I've corrected this problem.