是否有可能在.htaccess文件不同,具体取决于主机名设置SETENV变量?
Is it possible to set a SetEnv variable in an .htaccess file differently depending on hostname?
例如,我需要我的的.htaccess
文件具有以下值:
For example, I need my .htaccess
file to have the following value:
SetEnv PYRO_ENV production
在生产箱,以及...
On production boxes, and...
SetEnv PYRO_ENV stage
在分期盒。该的.htaccess
文件版本控制,这就是我正在寻找一个解决方案,有条件的原因。
On staging boxes. The .htaccess
file is version controlled, which is the reason I'm looking for a conditional solution.
可以,与mod_rewrite的:
You can, with mod_rewrite:
RewriteEngine on
RewriteCond %{HTTP_HOST} ^stage.domain.com$
RewriteRule (.*) $1 [E=PYRO_ENV:stage]
RewriteCond %{HTTP_HOST} ^www.domain.com$
RewriteRule (.*) $1 [E=PYRO_ENV:production]