I currently have a mysite.com (A) which points to /public_html/ and a dev.mysite.com (B) which I created a /dev_html/ for that. I cloned the site but now I need a way of switching between them without having to copy all the files from one dir to another and without bringing the site down. I just want to switch the live site to B and then work on A, and when I finish, switch the live site to A and work on B. Is there a simple way? I'm using cPanel X and cPanel 11 (WHM VPS). Also, both can interact with the same database so that's not an issue as I'm not changing any database structure. Only the php/js/img files need to switch.
How do you do A/B switching in a web app? (for deploying updates)
124 Views Asked by stagas At
2
There are 2 best solutions below
0

vhost file
Edit your vhosts file to point to the other directory.
Currently you will have a container that states that the site files are located at public_html
Change that to dev_html and run the following command to see if it all went ok.
apache configtest
If there are no errors, run
apache restart
Not sure if you have options to map domains, sub domains to folders in CPANEL as Im not a huge cpanel fan. The hosting company that I use allows mapping folders to domains and subdomains that I create so I have two folders too.
One of my folders in v1 and other folder is v2.
I point the live domain to v1 when Im working on enhancements on the version in v2 and point the domain to v2 when I have to do enhancements on v1 (but when switch happens I have to copy the files anyway- the advantage is that the beta website throws errors while Im copying over and not the main website)