Apache AliasMatch指令中的变量

时间:2019-03-05 08:54:15

标签: apache

背景知识

对于Apache 2.4,我有一个项目目录,文件index.html位于DocumentRoot。我希望为home.htmlindex.html创建一个别名,以便用户可以访问<HostName>/home.html<HostName>/index.html并返回index.html的内容。

我正在为此使用AliasMatch指令:

AliasMatch "^/home.html(.*)$" "%{DOCUMENT_ROOT}/index.html$1" // doesn't work

我已经可以使用Require all granted指令访问该目录。

现在,如果我使用变量%{DOCUMENT_ROOT},它将给出403禁止的错误。但是,如果要放置为DocumentRoot指定的完整路径,则可以使用它,例如:

AliasMatch "^/home.html(.*)$" "C:/my/document/root/index.html$1" // works

我不能在AliasMatch指令中使用变量吗?对此,Apache的文档并不十分清楚。

0 个答案:

没有答案