title: Handle multiple versions in same URL
body: <p>what I'm trying to do is to handle multiple versions of the same web application, somewhat like Google does with some of their products where you get the "Try the new version" link.</p>
  
  <p>The goal is to have both a "stable" and a "beta" version of the webapp and letting the users try out the new features without forcing them (and their bugs) on them.</p>
  
  <p>Now, a very simple way of doing this would be to put each version in its own subfolder, like www.mywebapp.com/v1 and www.mywebapp.com/v2.</p>
  
  <p>However, I would like this to be transparent to the user and the webapp URL to stay the same (e.g.: www.mywebapp.com/).</p>
  
  <p>Which version must be loaded is determined server-side after the user logs in (e.g.: active version for the given user is stored in the DB) and may be later changed when the user clicks on the "try the new version"/"go back to the old version" links.</p>
  
  <p>On the server side I must make do with MySQL, PHP and Apache.</p>
  
  <p>I have already managed to get this working placing each version into its own subfolder, then storing version information in cookies (updated by the server at each login or page refresh) and using RewriteRule(s) to "proxy" requests from the base/versionless URL to the proper subfolder. If no cookie is set, a default folder is selected by a fallback RewriteRule.</p>
  
  <p>This kludge works but feels extremely fragile and it puts additional burden on the Apache daemon so here I am asking if anybody knows a better way of doing this.</p>
  
  <p>Thanks!</p>