【发布时间】:2011-08-06 22:29:30
【问题描述】:
我现在有了这个:
<Directory ~ "^/home/.*">
php_flag open_basedir "/home/$1"
</Directory>
但这不起作用。我怎么能引用那个.*?
【问题讨论】:
标签: php apache apache2 directory open-basedir
我现在有了这个:
<Directory ~ "^/home/.*">
php_flag open_basedir "/home/$1"
</Directory>
但这不起作用。我怎么能引用那个.*?
【问题讨论】:
标签: php apache apache2 directory open-basedir
不可能。 Apache 不解释指令中的任何变量设置。您可以在某些情况下使用%1 样式的 RewriteCond 反向引用,甚至可以使用%{DOCUMENT_ROOT}。但大多数指令使用静态值。
特别是 PHP Apache SAPI 不会尝试解释任何 % 或 $ 序列。
Serverfault: Using variables in Apache config files to reduce duplication? 上列出了一些解决方法。但是mod_macro 或mod_define 都不会完成你想要的。您必须分别为每个主目录定义它。 (这也是 Plesk 和 Confixx 为多个帐户所做的事情。)
【讨论】: