Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/.htaccess/6.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
.htaccess 跨域访问不工作_.htaccess_Ubuntu_Apache2_Crossdomain.xml - Fatal编程技术网

.htaccess 跨域访问不工作

.htaccess 跨域访问不工作,.htaccess,ubuntu,apache2,crossdomain.xml,.htaccess,Ubuntu,Apache2,Crossdomain.xml,我正在尝试对xml文件进行跨域请求。在.htaccess中,我有 <IfModule mod_headers.c> Header set Access-Control-Allow-Origin "*" </IfModule> 但我仍然收到 请求的资源上不存在“Access Control Allow Origin”标头。因此,不允许访问源“*” 按如下方式编辑,应用您的路径: <Directory /var/www/> Options Ind

我正在尝试对xml文件进行跨域请求。在
.htaccess
中,我有

<IfModule mod_headers.c>
    Header set Access-Control-Allow-Origin "*"
</IfModule>
但我仍然收到

请求的资源上不存在“Access Control Allow Origin”标头。因此,不允许访问源“*


按如下方式编辑,应用您的路径:

<Directory /var/www/>
    Options Indexes FollowSymLinks MultiViews
    AllowOverride All
    Order allow,deny
    allow from all
</Directory>

选项索引跟随符号链接多视图
允许超越所有
命令允许,拒绝
通融

并确保您拥有正在编辑的正确虚拟主机配置。例如,
apache2/sites available/myVirtualWebsite.com

这一个对我来说很有用,但还有一件更重要的事情:mod_头没有安装。
<Directory /var/www/>
    Options Indexes FollowSymLinks MultiViews
    AllowOverride All
    Order allow,deny
    allow from all
</Directory>