时间:2021-12-1 作者:网络剑客 分类: other
1、编辑httpd.conf 找下面这行,把#去掉,目的是开启apache头资讯自定义模组
开启这一行注释
LoadModule headers_module modules/mod_headers.so
2、.htaccess 文件里面增加
<IfModule mod_rewrite.c>
<IfModule mod_negotiation.c>
Options -MultiViews -Indexes
</IfModule>
#增加内容开始
<IfModule mod_headers.c>
Header add Access-Control-Allow-Origin: *
Header add Access-Control-Allow-Headers: "Origin, X-Requested-With, authorization,ContentType,Content-Type, Accept, hotelid"
</IfModule>
#增加内容结束
RewriteEngine On
# Handle Authorization Header
RewriteCond %{HTTP:Authorization} .
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
# Redirect Trailing Slashes If Not A Folder...
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} (.+)/$
RewriteRule ^ %1 [L,R=301]
# Send Requests To Front Controller...
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [L]
</IfModule>