且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

htaccess 访问控制允许来源

更新时间:2023-01-08 23:18:51

在外部根文件夹的.htaccess中试试这个:

Try this in the .htaccess of the external root folder :

<IfModule mod_headers.c>
    Header set Access-Control-Allow-Origin "*"
</IfModule>

如果它只涉及 .js 脚本,你应该把上面的代码包装在这个里面:

And if it only concerns .js scripts you should wrap the above code inside this:

<FilesMatch ".(js)$">
...
</FilesMatch>