requests are taken to the wrong directory

Posted on

requests are taken to the wrong directory – Managing your servers can streamline the performance of your team by allowing them to complete complex tasks faster. Plus, it can enable them to detect problems early on before they get out of hand and compromise your business. As a result, the risk of experiencing operational setbacks is drastically lower.

But the only way to make the most of your server management is to perform it correctly. And to help you do so, this article will share nine tips on improving your server management and fix some problem about windows, apache-2.2, xampp, , .

I use xampp on windows 7 64, to test locally my php web application

I use virtual hosts to have access to my code from different domain names.

Now, I created a new version of the code and want to access both versions using different domain names.

I added a new virtual host newversion.mysite.local to httpd-vhosts.conf and directed it to the directory of the new version.
Also updated the windows hosts file with the line 127.0.0.4 newversion.mysite.local

A strange thing happens: when browsing to newversion.mysite.local I’m being taken to the old version, which is located at a different location.

How the hell this happens?
Please help me with ideas

Thank you

Gidi

Solution :

Just a wild guess but Apache answers using the first vhost entry it finds. I’d double check that you vhost entries actually use the different hostnames.

As pst said, I bet it’s serving the first virtual host configuration. Did you test your configuration with apachectl -S ? This will output what virtual hosts are being loaded. My money’s on a misconfigured NameVirtualHost.

Verify you have

NameVirtualHost 127.0.0.4

in your httpd.conf before the virtual host configurations.

Leave a Reply

Your email address will not be published.