TheOptimizationIdiot - 9:38 pm on May 5, 2013 (gmt 0)
to me, it looks like i am running 2 separate websites in 2 separate folders on server with 2 separate db but .htaccess is:
Yes, but the .htaccess is actually sending all requests for www.exmaple.com to a php script internally.
Basically what I posted is a "PHP Switch" so rather than one code set running on www.example.com and another one running on site2.example.com you move both to their own sub-domain for now.
What you currently have running on www.example.com moves to code-set1.example.com and what you would be putting on site2.example.com is set up on code-set2.example.com.
Then when a visitor requests a page from www.example.com the .htaccess sends that request to the php script which "grabs" the info from either code-set1.example.com or code-set2.example.com randomly and shows the visitor that version of info. (The cookie keeps them visitors from switching from one code set to another to the other in the middle of a visit, so it's random on a per-visit basis rather than on a per-page basis.)
That way only www.example.com is accessible externally (to visitors or search engines), but internally you're switching back and forth between what code set is shown to users who visit www.example.com for testing purposes.
So, in short:
Externally, all visitors are sent to www.example.com
Internally, you're accessing either code-set1.example.com or code-set2.example.com via PHP and showing one or the other to the visitor on www.example.com for split testing.
Hope that makes sense.