Rumah > Soal Jawab > teks badan
Dalam .htaccess saya mempunyainya seperti di bawah. Tetapi saya terus mendapat kesilapan.
Akses kepada XMLHttpRequest di "https:..." daripada sumber "https://..." telah disekat oleh CORS Dasar: Pengepala 'Access-Control-Allow-Origin' tidak wujud pada Sumber yang diminta.
Header set Access-Control-Allow-Origin "*" Header set Access-Control-Allow-Origin "PUT, POST, DELETE, GET, OPTIONS" Header set Access-Control-Allow-Origin "Accept, Authorization, Content-Type" RewriteEngine On Options All -Indexes # ROUTER WWW Redirect. RewriteCond %{HTTP_HOST} !^www\. [NC] RewriteRule ^ https://www.%{HTTP_HOST}%{REQUEST_URI} [L,R=301] # ROUTER HTTPS Redirect RewriteCond %{HTTP:X-Forwarded-Proto} !https RewriteCond %{HTTPS} off RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301] # ROUTER URL Rewrite RewriteCond %{SCRIPT_FILENAME} !-f RewriteCond %{SCRIPT_FILENAME} !-d RewriteRule ^(.*)$ index.php?route=/ [L,QSA]
P粉5931184252024-01-29 09:00:37
Anda hanya boleh mempunyai satu pengepala "Benarkan asal", jadi pengepala terakhir akan ditafsirkan.
Header set Access-Control-Allow-Origin "*" Header set Access-Control-Allow-Methods "PUT, POST, DELETE, GET, OPTIONS" Header set Access-Control-Allow-Headers "Accept, Authorization, Content-Type"