We have a site www.site.example using IP address and we have a newly designed website running from a test run subdomain testrun.site.example using IP address

Now the newly designed website is done. It has the same directory structure, we keep the URL intact, same location of images , but different design overall.

Question: if I change the DNS A record of www.site.example website to use the IP address of testrun.site.com( will my www.site.example use the new design from the testrun subdomain testrun.site.example?

Is this possible?


  • Site is hosted with Apache
  • The testrun.site.example and site.exampleis hosted from the same dedicated server
  • Much depends upon your set-up. Is the sub-domain hosted on the same server as your current website? Are you using Apache? What else can you tell us so that we can formulate a better answer for you. My first inclination would be to answer not likely but I do not have enough information to formulate an accurate answer yet. Can you edit your question with some details about how these sites are set up?
    – closetnoc
    Mar 28 '14 at 3:55
  • hi , yes its apache, and hosted from the same webhosting. I edited the question.
    – LayoutPH
    Mar 28 '14 at 4:07

I am not sure this will work the way you imagine. I could be wrong.

I am assuming that both sites are on the same Apache server. I am also assuming that your sites are set up as example.com and not www.example.com and testrun.example.com. Most of the time, a site on Apache would set up as example and example.com would have an IP address assigned in the DNS. www.example.com would be a CNAME that points to example.com. I am working on this premise.

Generally Apache is assigned IP addresses and ports to listen to in the ports.conf file. Websites within Apache are not normally assigned IP addresses. You will have to check your configuration files. If this is the case, then Apache will take any packet in regardless of the IP address and process them the same.

Apache will take the request packet, examine the to address and try and match it to a website. It may still try and match any request sent to example.com or www.example.com to example.com and not to testrun.example.com. This is because the request packet will not be addressed to testrun.example.com.

Check your configuration files.

Your can find your Apache configuration files in /etc/apache2/ or /etc/local/apache2/. Check the ports.conf file and you should see both IP addresses. You will find your site specific configuration files in /sites-available/. The file name format would be domainname.tld.conf and sub-domain.domainname.tld.conf. Check both files for the existence of your IP addresses.

If you do not see the IP addresses in the site configuration files, then I would say that I do not believe your idea will work. If you do, then I would say perhaps- try it.

If you can afford a short period of downtime, then you can experiment and try this scenario easily. Otherwise, if up time is critical, I would not mess around and simply deploy your new site over your old site only after two complete backups are completed that you are sure you can use to restore the site.

In fact, the other answer to change the directory should also work and could easily be backed out if you change your mind.


If that is on the exact same server, the IP should not matter. What will matter is the Apache setup. You probably only have to change the DocumentRoot directive of the www.example.com entry to use the same directory as the new website.

DocumentRoot /var/www/look-here-now

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.