I am trying to come up with a way of redirecting all requests for files in the directory http://mydomain/swchoir/<filename> to the file with the same name (and the same GET parameters if present) in the directory /home/myaccount/build00001/public_html/swchoir/<filename>.
My end objective is to allow the server to contain several different builds and for people who have the necesary permissions to be able to choose which one they want to look at, so for example I could have one build that is on public release, another that is in QA, and a third which is in development. Ordinary users would only be able to see the public release one. QA people would be able to see either the public release or the QA build. And developers would be able to see all of them.
As a step towards this, I am trying to develop some rewrite rules that will send _all_ users to build00001. The lines I have added to the .htaccess file in /home/sylvest/public_html are:
SetEnvIfExpr True build_num=00001 Rewrite Rule ^swchoir/([0-9a-z/\.?&_=-]+)$ /home/myaccount/buildbuild_num/public_html/swchoir/$1 [NC, L] php_value include_path ".:/home/myaccount/buildbuild_num/include"
Now when I try to access a page I get an internal server error.
Please can you suggest what is wrong with my rule, or how to best get this to do what I want? In particular I'm not sure how to use the Environmental Variable build_num that I have tried to define. I'm not sure whether "SetEnvIfExpr True" is valid, and I'm not sure whether "sylvest/buildbuild_num/public_html" is a valid way of using the variable. Seems unlikely, but I'm not sure whether it needs some kind of quotes to indicate that it is a variable name, and if so, what kind.
If you know a better way of doing the whole job, please tell me that too. It seems odd to me that something like this doesn't already exist somewhere, since it surely must be a commmon need.
Thanks - Rowan