webfont不apear加wwwwebfont、apear、www

2023-09-02 09:38:20 作者:凝

我试图找到答案无处不在。我有一个星网站 www.hugeone.co.uk 。当地址就像是在这个环节(以www。)一切正常。但是,如果我只键入hugeone.co.uk webfonts不出现,而我得到的消息:

I have tried to find the answer everywhere. I have a sing website www.hugeone.co.uk. When the address is like in this link (with www.) everything is ok. But if I type only hugeone.co.uk webfonts do not appear, and I get the message:

跨域请求阻止:同源策略不允许的阅读   在远程资源   的http://www.hugeone.co.uk/includes/templates/huheone/css/fonts/dirtyheadline-webfont.woff.   这可以固定通过移动资源到相同域或   启用CORS。

Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at http://www.hugeone.co.uk/includes/templates/huheone/css/fonts/dirtyheadline-webfont.woff. This can be fixed by moving the resource to the same domain or enabling CORS.

我的.htaccess文件:

my .htaccess file:

RewriteEngine On

# Don't rewrite any URIs ending with a file extension (ending with .[xxxxx])
RewriteCond %{REQUEST_URI} !.[a-z]{2,5}$ [NC]
# Don't rewrite any URIs for some, popular specific file format extensions,
#   which are not covered by main file extension condition above
RewriteCond %{REQUEST_URI} !.(mp3|mp4|h264)$ [NC]

RewriteCond %{REQUEST_URI} !^/editors/ [NC]
# Don't rewrite .settings directory
RewriteCond %{REQUEST_URI} !^/.settings/ [NC]
# Don't rewrite ajax_bin directory
RewriteCond %{REQUEST_URI} !^/ajax_bin/ [NC]
# Don't rewrite artwork directory
RewriteCond %{REQUEST_URI} !^/artwork/ [NC]
# Don't rewrite bigdump directory
RewriteCond %{REQUEST_URI} !^/bigdump/ [NC]
# Don't rewrite bmz_cache directory
RewriteCond %{REQUEST_URI} !^/bmz_cache/ [NC]
# Don't rewrite catal directory
RewriteCond %{REQUEST_URI} !^/catal/ [NC]
# Don't rewrite catdescr directory
RewriteCond %{REQUEST_URI} !^/catdescr/ [NC]
# Don't rewrite ebay directory
RewriteCond %{REQUEST_URI} !^/ebay/ [NC]
# Don't rewrite feed directory
RewriteCond %{REQUEST_URI} !^/feed/ [NC]
# Don't rewrite fonts directory
RewriteCond %{REQUEST_URI} !^/fonts/ [NC]
# Don't rewrite ftp-uploads directory
RewriteCond %{REQUEST_URI} !^/ftp-uploads/ [NC]
# Don't rewrite harvest directory
RewriteCond %{REQUEST_URI} !^/harvest/ [NC]
# Don't rewrite invoices directory
RewriteCond %{REQUEST_URI} !^/invoices/ [NC]
# Don't rewrite jobs directory
RewriteCond %{REQUEST_URI} !^/jobs/ [NC]
# Don't rewrite logo directory
RewriteCond %{REQUEST_URI} !^/logo/ [NC]
# Don't rewrite londynek directory
RewriteCond %{REQUEST_URI} !^/londynek/ [NC]
# Don't rewrite phpmyadmin directory
RewriteCond %{REQUEST_URI} !^/phpmyadmin/ [NC]
# Don't rewrite populate directory
RewriteCond %{REQUEST_URI} !^/populate/ [NC]
# Don't rewrite temp directory
RewriteCond %{REQUEST_URI} !^/temp/ [NC]
# Don't rewrite test directory
RewriteCond %{REQUEST_URI} !^/test/ [NC]
# Don't rewrite uploads directory
RewriteCond %{REQUEST_URI} !^/uploads/ [NC]
# Don't rewrite very_secret directory
RewriteCond %{REQUEST_URI} !^/very_secret/ [NC]
# Don't rewrite video directory
RewriteCond %{REQUEST_URI} !^/video/ [NC]
# Handle all other URIs using Zen Cart (its index.php)
RewriteRule .* index.php [QSA,L]

## END CEON URI MAPPING REWRITE RULE

#WEBFONTS

AddType font/ttf .ttf
AddType font/eot .eot
AddType font/otf .otf
AddType font/woff .woff

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

我不知道我能做些什么了。

I do not know what I can do more.

推荐答案

如果重定向所有的非 - WWW 要求 WWW 是你可以做这样的一个选项:

If redirecting all the non-WWW requests to WWW is an option you could do this:

RewriteCond %{HTTP_HOST} ^hugeone.co.uk$ [NC]
RewriteRule ^ http://www.hugeone.co.uk%{REQUEST_URI} [R=301,L]

补充一下,右如下:

Add that right below:

RewriteEngine On
# optional you might not have the below in your file.
RewriteBase /

在你的的.htaccess 文件。

这是替代上面会使用,使CORS你的的.htaccess 的webfonts这将是这样的:

An alternative to the above would be to enable CORS using your .htaccess for webfonts it would be like this:

<IfModule mod_headers.c>
  <FilesMatch ".(ttf|ttc|otf|eot|woff|font.css|css)$">
    Header set Access-Control-Allow-Origin "*"
  </FilesMatch>
</IfModule>

作为一个侧面说明了,如果你不使用好这两种 WWW 和非 - WWW 如谷歌,例如不喜欢看到两者。的

As a side note its better if your don't use both WWW and non-WWW as Google for instance doesn't like seeing both.