有问题的htaccess文件

时间:2017-10-15 12:05:38

标签: apache .htaccess

我正在尝试允许任何网站或桌面应用调用我网站上某个特定文件夹中的脚本。因此,我在该目录中放了一个.htaccess文件。它肯定被读取,但我在Apache错误日志文件中收到以下错误:

[Sat Oct 14 21:57:01.943348 2017] [core:alert] [pid 3944:tid 1172] [client ::1:57586] C:/wamp64/www/mysite/phpgeneral/.htaccess: Invalid command 'Header', perhaps misspelled or defined by a module not included in the server configuration, referer: http://localhost:52656/mysite/index.html
[Sat Oct 14 21:58:39.918523 2017] [core:alert] [pid 3944:tid 1164] [client ::1:57599] C:/wamp64/www/mysite/phpgeneral/.htaccess: Invalid command 'Header', perhaps misspelled or defined by a module not included in the server configuration, referer: http://localhost:52656/mysite/index.html

这是我的.htaccess文件。 这些命令是否应该包含它们?或者是否存在错误(我是.htaccess的新手)。

# Always set these headers.
Header always set Access-Control-Allow-Origin "*"
Header always set Access-Control-Allow-Methods "POST, GET, OPTIONS, DELETE, PUT"
Header always set Access-Control-Max-Age "1000"
Header always set Access-Control-Allow-Headers "x-requested-with, Content-Type, origin, authorization, accept, client-security-token"
# Added a rewrite to respond with a 200 SUCCESS on every OPTIONS request.
RewriteEngine On
RewriteCond %{REQUEST_METHOD} OPTIONS
RewriteRule ^(.*)$ $1 [R=200,L]

1 个答案:

答案 0 :(得分:1)

在Apache config

中加载headers_module