联系官方销售客服
1835022288
028-61286886
字体跨域问题与域名识别跳转两个疑问
运行环境:本地phpstudy8.1 amp,线上为阿里云万网虚拟linux主机。
xunruicms 4.3.11,后台跨站验证关闭,自动识别开启。
域名绑定:本站电脑域名www.nngt.com,本站手机域名m.nngt.com,本站其他域名,nngt.com
/.htaccess对于字体跨域如下 :
<FilesMatch "\.(ttf|ttc|otf|eot|woff|woff2|svg|font.css|css)$">
<IfModule mod_headers.c>
Header set Access-Control-Allow-Origin "*"
</IfModule>
</FilesMatch>
/mobile/.htaccess对于字体跨域同上 :
<FilesMatch "\.(ttf|ttc|otf|eot|woff|woff2|svg|font.css|css)$">
<IfModule mod_headers.c>
Header set Access-Control-Allow-Origin "*"
</IfModule>
</FilesMatch>
=============症状1报错:打开移动版页面时,页面红字提示错误如下:
Access to font at 'http://www.nngt.com/theme1/font_1640804/iconfont.woff2' from origin 'http://m.nngt..com' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource.
GET http://www.nngt..com/theme1/font_1640804/iconfont.woff2 net::ERR_FAILED
Access to font at 'http://www.nngt..com/theme1/font_1640804/iconfont.woff' from origin 'http://m.nngt..com' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource.
GET http://www.nngt..com/theme1/font_1640804/iconfont.woff net::ERR_FAILED
Access to font at 'http://www.nngt..com/theme1/font_1640804/iconfont.ttf' from origin 'http://m.nngt..com' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource.
GET http://www.nngt.com/theme1/font_1640804/iconfont.ttf net::ERR_FAILED
============症状2:域名识别跳转疑问==============
手机浏览器输入www.nngt.com/show-xx.com,可自动跳转m.nngt.com/show-xx.com。但换成输入(或打开)不带三大不溜开头的nngt.com/show-xx.com,手机浏览器无法自动跳转到m.nngt.com/show-xx.com
百度一大堆方案,可以的话给赏金吧
RewriteCond %{REQUEST_URI} !^/mobile/RewriteRule ^(.*)$ mobile/$1?Rewrite [L,QSA]RewriteCond %{REQUEST_FILENAME} !-fRewriteCond %{REQUEST_FILENAME} !-dRewriteRule . /index.php [L] </IfModule><FilesMatch "\.(ttf|ttc|otf|eot|woff|woff2|svg|font.css|css)$"> <IfModule mod_headers.c> Header set Access-Control-Allow-Origin "*" </IfModule></FilesMatch>因此赏金只能给第二个问题:域名识别跳转疑问==============手机浏览器输入www.nngt.com/show-xx.com,会自动跳转m.nngt.com/show-xx.com。但换成输入(或打开)不带三大不溜开头的nngt.com/show-xx.com,手机浏览器无法自动跳转到m.nngt.com/show-xx.com