2017-10-15 53 views
0

我想讓任何網站或桌面應用程序在我的網站上的一個特定文件夾中調用腳本。因此,我已將.htaccess文件放在該目錄中。它肯定是被讀,但我在Apache的錯誤日誌文件中得到以下錯誤:有問題的htaccess文件

[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] 
+0

不知道,如果** **一直是相關而不是**頭設置訪問控制允許來源「*」 ** – 2017-10-15 12:10:16

+1

嘗試加載在Apache headers_module配置 – user4035

+0

@ user4035 - 做到了這一點。把一條線的答案,我將它標記爲答案。 – Rewind

回答

1

負載Apache的配置裏面headers_module