vhost配置环境变量:SetEnvIf ENV ^(.*)$ APPLICATION_ENV=dev
htaccess配置获取环境变量并转发:
#SetEnvIf ENV ^(.*)$ APPLICATION_ENV=staging
#RewriteRule ^ - [E=APPLICATION_ENV:test]
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} -f
RewriteRule .? - [L]

RewriteCond %{REQUEST_URI} ^/$
RewriteRule ^(.*)$ /index.html [QSA,L]

RewriteCond %{REQUEST_URI} !^/qrStartAppWebview
RewriteRule ^(.*)$ / [R=403,L]

RewriteCond %{ENV:APPLICATION_ENV} dev [NC]
RewriteRule ^(.*)$ app_dev.php [QSA,L]
RewriteCond %{ENV:APPLICATION_ENV} test [NC]
RewriteRule ^(.*)$ app_test.php [QSA,L]
RewriteCond %{ENV:APPLICATION_ENV} staging [NC]
RewriteRule ^(.*)$ app_staging.php [QSA,L]
RewriteRule ^(.*)$ app.php [QSA,L]
</IfModule>