Apache之.htaccess文件配置允许跨域

person smartzeng    watch_later 2017-06-05 10:09:12
visibility 813    class APACHE,Htaccess,跨域请求,RewriteEngine    bookmark 分享

设置允许跨域头

Header set Access-Control-Allow-Origin 允许的请求地址

设置域名访问

<IfModule mod_rewrite.c>
	RewriteEngine On
	RewriteBase /
	#-判断规则,若有多个域名则写多条.(除了以下域名,其他均不允许访问)
	rewritecond %{http_host}  !^tesy.com$ [nc]
	#rewritecond %{http_host} !^testa1.pw$ [nc]
	#rewritecond %{http_host} !^testa2.pw$ [nc]
	#-禁止规则
	rewriterule ^.* - [F,L]
</IfModule>


评论区
评论列表
menu