将环境变量插入到字符串中

将环境变量插入到字符串中

在一个<VirtualHost>区块中我有这个:

# Extract the first subdir and assign it to "subdir"
SetEnvIfNoCase Request_URI "^/?([^/]*)(?:/|$)" subdir=$1

# Add the subdir to the logging path
CustomLog "|bin/rotatelogs.exe -l c:/logs/%Y.%m_apache_%{ENV:subdir}_access.log 86400" combined

但它并没有创造期望的结果:

c:\logs\apache_app1_access.log
c:\logs\apache_app2_access.log
c:\logs\apache_app3_access.log

我在错误日志中看到此错误:

AH00106: piped log program 'bin/rotatelogs.exe -l c:/logs/%Y.%m_apache_%{ENV:subdir}_access.log 86400' failed unexpectedly
Invalid filename given

删除此部分可使其正常工作:

_%{ENV:subdir}

改變也失败了_%{ENV:subdir}_${ENV:subdir}

相关内容