【发布时间】:2019-08-17 17:25:02
【问题描述】:
所以我在这里读到: https://httpd.apache.org/docs/current/howto/htaccess.html
我应该避免使用 .htaccess 文件,因为它们会降低性能。 因为到目前为止我还没有让它与 .htaccess 文件一起使用 (How to enable CORS from .htaccess (inside ZURB Foundation Project))
我会试一试并将其写入我的 httpd.conf
现在我在这里读到以下内容: https://www.w3.org/wiki/CORS_Enabled
“要公开标题,您可以在<Directory>、<Location> 和<Files> 部分或.htaccess 文件中添加以下行。
<IfModule mod_headers.c>
Header set Access-Control-Allow-Origin "*"
</IfModule>"
但是我很难理解这到底是什么意思^^ 我确实在我的 httpd.conf 中找到了以下“部分”(如果这就是他们所指的),它看起来像这样:
<Directory />
AllowOverride none
Require all denied
</Directory>
我还可以找到一个文件部分:
<Files ".ht*">
Require all denied
</Files>
但我找不到位置部分,这让我想知道我是否真的在寻找正确的位置,以及是否将上面引用的代码从 wiki 放入目录和文件部分是否正确?
【问题讨论】: