Take the 2-minute tour ×
Webmasters Stack Exchange is a question and answer site for pro webmasters. It's 100% free, no registration required.

We have a site www.site.com using ip 123.456.789 and we have a newly design website running from a test run subdomain testrun.site.com using ip 987.654.321.

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.com website to use
the ip of testrun.site.com 987.654.321 will my www.site.com use the new design from the testrun subdomain testrun.site.com?

Is this possible?

NOTE:

  • Site is hosted in apache
  • The testrun.site.com and site.com is hosted from the same dedicated server.
share|improve this question
    
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 at 3:55
    
hi , yes its apache, and hosted from the same webhosting. I edited the question. –  LayoutPH Mar 28 at 4:07

2 Answers 2

up vote 0 down vote accepted

If that's 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.site.com entry to use the same directory as the new website.

DocumentRoot /var/www/look-here-now
share|improve this answer
    
Thank you looks cool. –  LayoutPH Mar 28 at 6:20

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 site.com and not www.site.com and testrun.site.com. Most of the time, a site on Apache would set up as site.com and site.com would have an IP address assigned in the DNS. www.site.com would be a CNAME that points to site.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 site.com or www.site.com to site.com and not to testrun.site.com. This is because the request packet will not be addressed to testrun.site.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.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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