0

I have hosted several websites in an old server, now I want to move them to new server. Before switching DNS I want to test whether everything works fine in new server. For this, I copied all the websites to my new server. I then configured new server's Virtual Host with NamedVirtualHost Enabled as follows.

<VirtualHost *:80>
    ServerName localhost
    DocumentRoot "C:/server/www"
</VirtualHost>

<VirtualHost *:80>
    ServerAdmin [email protected]
    DocumentRoot "c:/server/www/siteone"
    ServerName siteone.com
    ServerAlias www.siteone.com
     <Directory "c:/server/www/siteone">
        AllowOverride All
    </Directory>
</VirtualHost>

<VirtualHost *:80>
    ServerAdmin [email protected]
    DocumentRoot "c:/server/www/sitetwo"
    ServerName sitetwo.com
    ServerAlias www.sitetwo.com
     <Directory "c:/server/www/sitetwo"
        AllowOverride All
    </Directory>
</VirtualHost>

Lets say IP of new remote server is 10.10.10.10. I then edited host file of remote server to enter 10.10.10.10 www.siteone.com. I checked it works there.

Now i wanted to check it from my local machine (not remote). I edited host file of my local machine to include 10.10.10.10 www.siteone.com. But it always loaded from original location(from the place where it is live currently.) . I tried flushing DNS, clearing browser cache, restarting browser. But all in vain. but how ever if I browse 10.10.10.10 from my local machine, it lists the folders of document root i.e. C:\server\www. Where might I be doing wrong? Can anybody help me please.

EDIT: My host file

10.10.10.10 siteone.com
10.10.10.10 www.siteone.com
10.10.10.10 sitetwo.com
10.10.10.10 www.sitetwo.com

P.s. If i ping www.siteone.com then it gives correct IP 10.10.10.10

Server has Windows 2008 R2, and my local computer has windows 7 pro.

Thanks A lot

2
  • Have you edit hosts file on your local machine from which you have tried to open site from the new server?
    – ALex_hha
    Aug 13, 2013 at 15:27
  • @ALex_hha, Yes i did, i edited host file in my local computer to direct www.siteone.com to 10.10.10.10, I flushed dns, cleared browser cache, restarted browser also
    – WatsMyName
    Aug 13, 2013 at 15:34

1 Answer 1

0

You need to define "siteone.com" as 10.10.10.10 as well as "www.siteone.com", it has to hit the server (siteone.com) before it can go to the ServerAlias (www.siteone.com).

Technically, siteone.com and www.siteone.com are different records, with siteone.com being the main domain and www.siteone.com just being one subdomain. So, you should have something like:

10.10.10.10 siteone.com
10.10.10.10 www.siteone.com
2
  • 1
    didn't get you, can you explain a little more? may be with example?
    – WatsMyName
    Aug 13, 2013 at 15:24
  • Well that I have already done in my local machine host file
    – WatsMyName
    Aug 14, 2013 at 2:55

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .