I faced something similar when I wanted to run two different versions
of web2py (the framework itself) on one server. It worked well to use
a pattern like this:
WSGIScriptAliasMatch ^/(someappname)
/var/local/web2py/wsgihandler.py/
$1
AliasMatch ^/(someappname)/static/(.*) /var/local/web2py/
applications/$1/static/$2
That routes exactly the "/someappname/*" URLs to the particular web2py
instance. I had other alias rules set up to route things to the
second web2py instance. That second instance could have instead been
PHP content or the like, I believe.
By passing the matched app path prefix as an argument to
wsgihandler.py I didn't need a routes.py file at all. The WSGI and
web2py machinery took care of the details. Very slick. (Each web2py
instance has its own WSGIProcessGroup associated with its directory.)