基於環境變量的存在,我試圖在Apache 2.4 <VirtualHost>
中包含一個配置文件。基於環境變量的Apache VirtualHost條件
裏面VirtualHost
聲明,我設置了VIEWMODE
環境變量,例如:
Define virtualhost_config "${virtualhost_path}/conf/virtualhost.conf"
<VirtualHost *:80>
SetEnv VIEWMODE demo
Include "${virtualhost_config}"
</VirtualHost>
裏面所包含的配置文件,我現在有<Directory>
塊內這個條件:
<If "env('VIEWMODE') == 'demo'">
RewriteRule (.*) http://www.apple.com/ [L,R=302]
</If>
然而,我似乎無法得到這個工作。條件RewriteRule
被忽略。
我錯過了什麼?
在'If'裏面使用'Redirect 302'http://www.apple.com/「',否則我不確定沒有'RewriteEngine On'就可以工作。 – Deadooshka