开发者

Apache: open_basedir with variable

开发者 https://www.devze.com 2023-02-25 01:52 出处:网络
I now hav开发者_如何学Pythone this: <Directory ~ \"^/home/.*\"> php_flag open_basedir \"/home/$1\"

I now hav开发者_如何学Pythone this:

<Directory ~ "^/home/.*">
php_flag open_basedir "/home/$1"
</Directory>

But that doesn't work. How can I refer to that .*?


Not possible. Apache does not interpret any variable settings in directives. You can use %1 style RewriteCond backreferences in some, or %{DOCUMENT_ROOT} even. But most directives use static values.

Specifically PHPs Apache SAPI does not attempt to interpret any % or $ sequences.

There are a few workarounds listed on Serverfault: Using variables in Apache config files to reduce duplication?. But neither mod_macro or mod_define will accomplish what you want. You will have to define it for each home directory separately. (That is also what Plesk and Confixx do for multiple accounts.)

0

精彩评论

暂无评论...
验证码 换一张
取 消