htaccess已允许来源但仍显示错误错误

时间:2018-06-29 01:31:52

标签: .htaccess cors

我有这个.htaccess

RewriteEngine on
RewriteBase /

# To force CN to use https
RewriteCond %{HTTP_HOST} ^jobs.connectnigeria\.com [NC]
RewriteCond %{SERVER_PORT} 80 
RewriteCond %{REQUEST_URI} !^/\.well-known/cpanel-dcv/[0-9a-zA-Z_-]+$
RewriteCond %{REQUEST_URI} !^/\.well-known/pki-validation/[A-F0-9]{32}\.txt(?:\ Comodo\ DCV)?$
RewriteRule ^(.*)$ https://jobs.connectnigeria.com/$1 [R,L]

RewriteCond $1 !^(index\.php|images|css|js|robots\.txt|favicon\.ico)
RewriteCond %{REQUEST_FILENAME} -f [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteCond %{REQUEST_URI} !^/[0-9]+\..+\.cpaneldcv$
RewriteCond %{REQUEST_URI} !^/[A-F0-9]{32}\.txt(?:\ Comodo\ DCV)?$
RewriteCond %{REQUEST_URI} !^/\.well-known/cpanel-dcv/[0-9a-zA-Z_-]+$
RewriteCond %{REQUEST_URI} !^/\.well-known/pki-validation/[A-F0-9]{32}\.txt(?:\ Comodo\ DCV)?$
RewriteRule ^.*$ - [L]

#RewriteCond %{HTTP_HOST} !^www\.(.*)
#RewriteRule (.*) http://www.%{HTTP_HOST}/$1 [R=301,L]

# dont rewrite if there was posted here!
RewriteCond %{REQUEST_URI} !(.*)/$
RewriteCond %{REQUEST_METHOD} !POST 
RewriteCond %{REQUEST_URI} !\.html?$ [NC]
RewriteCond %{REQUEST_URI} !^/[0-9]+\..+\.cpaneldcv$
RewriteCond %{REQUEST_URI} !^/[A-F0-9]{32}\.txt(?:\ Comodo\ DCV)?$
RewriteCond %{REQUEST_URI} !^/\.well-known/cpanel-dcv/[0-9a-zA-Z_-]+$
RewriteCond %{REQUEST_URI} !^/\.well-known/pki-validation/[A-F0-9]{32}\.txt(?:\ Comodo\ DCV)?$
RewriteRule ^(.*[^/])$ $1/ [L,R=301]

RewriteCond %{REQUEST_URI} !^/[0-9]+\..+\.cpaneldcv$
RewriteCond %{REQUEST_URI} !^/[A-F0-9]{32}\.txt(?:\ Comodo\ DCV)?$
RewriteCond %{REQUEST_URI} !^/\.well-known/cpanel-dcv/[0-9a-zA-Z_-]+$
RewriteCond %{REQUEST_URI} !^/\.well-known/pki-validation/[A-F0-9]{32}\.txt(?:\ Comodo\ DCV)?$
RewriteRule ^(.*)$ ./index.php?/$1 [L,QSA]
#RewriteRule ^(.*)$ index.php/$1 [L,QSA]

<FilesMatch ".(eot|ttf|otf|woff|woff2)">
  Header set Access-Control-Allow-Origin "*"
</FilesMatch>

#User-agent: *
#Disallow: /

# php -- BEGIN cPanel-generated handler, do not edit
# Set the “ea-php54” package as the default “PHP” programming language.
<IfModule mime_module>
  AddType application/x-httpd-ea-php54 .php .php5 .phtml
</IfModule>
# php -- END cPanel-generated handler, do not edit

如您所见,我有这个

<FilesMatch ".(eot|ttf|otf|woff|woff2)">
    Header set Access-Control-Allow-Origin "*"
</FilesMatch>

但仍然向我显示此错误

enter image description here

有什么帮助,有想法吗?

1 个答案:

答案 0 :(得分:0)

cnmain.connectnigeria.com应该将字体的Access-Control-Allow-Origin标头设置为*jobs.connectnigeria.com。您正在jobs.connectnigeria.com上进行此操作。