【发布时间】:2015-12-31 11:14:53
【问题描述】:
假设我们在文件系统上有/home/example.org/public_html/ 目录,它作为我的虚拟主机的文档根目录。
该虚拟主机的相关 httpd 配置如下所示:
<VirtualHost *:80>
ServerName example.org:80
...
DocumentRoot /home/example.org/public_html
<Directory /home/example.org/public_html>
AllowOverride All
...
</Directory>
...
</VirtualHost>
为了防止在文件系统上进行 htaccess 查找而不丢失 htaccess 功能——至少在 DocumentRoot 级别——我将配置转换为以下内容:
<VirtualHost *:80>
ServerName example.org:80
...
DocumentRoot /home/example.org/public_html
<Directory /home/example.org/public_html>
AllowOverride None
Include /home/example.org/public_html/.htaccess
...
</Directory>
...
</VirtualHost>
区别
AllowOverride None
Include /home/example.org/public_html/.htaccess
让我们看看我们用这个完成了什么:
httpd 不会浪费任何时间寻找和解析 htaccess 文件 导致更快的请求处理
问题:
- 使用
Include指令,Apache 仅在服务启动时或每次请求时加载 htaccess? - 如果第 1 点是真的,如何在没有
httpd.exe -k restart的情况下刷新 apache conf?
【问题讨论】: