Page 1 of 1

Website Versioning with htaccess

Posted: Mon Oct 05, 2009 4:57 am
by onion2k
Is there a way to make versions of a website that you can easily control with htaccess? For example, imagine the following directory structure..

Code: Select all

/1.0/index.php
/1.0/stuff.php
/1.0/images/image.gif
/1.0/css/site.css
 
/2.0/index.php
/2.0/stuff.php
/2.0/images/image.gif
/2.0/css/site.css
 
Is there a way to make a rewrite rule that says domain.com/index.php points to domain.com/1.0/index.php, and domain.com/stuff.php points to domain.com/1.0/stuff.php, and so on? Then just by changing the 1.0 to 2.0 in htaccess, switch from one version to the other?

It feels like there should be, but so far everything I've tried has failed.

Re: Website Versioning with htaccess

Posted: Mon Oct 05, 2009 10:39 am
by pickle
This is what worked on my server:

Code: Select all

Options +FollowSymLinks
RewriteEngine on
RewriteBase /versioning/
RewriteRule ^([^1].*)$ 1/$1

Re: Website Versioning with htaccess

Posted: Mon Oct 05, 2009 11:27 am
by onion2k
Ahh.. I was trying to take too much of a shortcut I think. That seems to work pretty well. Cheers.