3

我不确定这是否是发布此内容的正确位置,因为我不知道问题出在哪里。基本上字体现在对我来说真的很痛苦,而且没有任何效果。我尝试从 google-fonts 加载字体并遇到 IE 问题,所以我决定自己下载并提供它们,但现在它在任何浏览器中都不起作用我收到错误:

“网络错误:403 禁止 - http://www.mychic.co.uk/includes/templates/SmartStart/fonts/architectsdaughter-webfont.woff ““网络错误:403 禁止 - http://www.mychic.co.uk/包括/模板/SmartStart/fonts/architectsdaughter-webfont.ttf "

我已经尝试使用权限来授予对文件的读取和执行权限,甚至尝试过 777 并且仍然遇到相同的错误,字体肯定在它们应该在的位置,我的 css 看起来像这样:

@font-face {
    font-family: 'architects_daughterregular';
    src: url('../fonts/architectsdaughter-webfont.eot');
    src: url('../fonts/architectsdaughter-webfont.eot?#iefix') format('embedded-opentype'),
         url('../fonts/architectsdaughter-webfont.woff') format('woff'),
         url('../fonts/architectsdaughter-webfont.ttf') format('truetype'),
         url('../fonts/architectsdaughter-webfont.svg#architects_daughterregular') format('svg');
    font-weight: normal;
    font-style: normal;

}

body { font-family: 'architects_daughterregular'; }

有人建议我添加一个 .htaccess 文件,因此我将以下内容添加到站点的根目录和字体目录(是否正确):

AddType application/vnd.ms-fontobject .eot
AddType application/x-font-ttf        .ttf
AddType application/x-font-woff       .woff

任何想法我在这里做错了什么 - 任何帮助/想法都非常感谢?

4

1 回答 1

7

感谢我的托管服务提供商,我已经找到了问题所在,我将尽我所能将信息传递给遇到相同问题的任何其他人:zencart 已在包含文件夹中包含一个 .htaccess 文件,该文件会阻止某些文件。删除这将解决问题,但也允许在服务器上运行脚本,因此最好只允许通过与您的字体文件相对应的文件类型(请参阅添加到文件匹配的 svg、eot、woff 和 ttf 文件类型):

#
# @copyright Copyright 2003-2010 Zen Cart Development Team
# @license http://www.zen-cart.com/license/2_0.txt GNU Public License V2.0
# @version $Id: .htaccess 18695 2011-05-04 05:24:19Z drbyte $
#
# This is used with Apache WebServers
#
# The following blocks direct HTTP requests to all filetypes in this directory recursively, except certain approved exceptions
# It also prevents the ability of any scripts to run. No type of script, be it PHP, PERL or whatever, can normally be executed if ExecCGI is disabled.
# Will also prevent people from seeing what is in the dir. and any sub-directories
#
# For this to work, you must include either 'All' or at least: 'Limit' and 'Indexes' parameters to the AllowOverride configuration in your apache/conf/httpd.conf file.
# Additionally, if you want the added protection offered by the OPTIONS directive below, you'll need to add 'Options' to the AllowOverride list, if 'All' is not specified. 
# Example:
#<Directory "/usr/local/apache/htdocs">
#  AllowOverride Limit Options Indexes
#</Directory>
###############################

# deny *everything*
<FilesMatch ".*">
  Order Allow,Deny
  Deny from all
</FilesMatch>

# but now allow just *certain* necessary files:
<FilesMatch ".*\.(js|JS|css|CSS|jpg|JPG|gif|GIF|png|PNG|swf|SWF|xsl|XSL|svg|eot|ttf|woff)$">
  Order Allow,Deny
  Allow from all
</FilesMatch>

IndexIgnore */*


## NOTE: If you want even greater security to prevent hackers from running scripts in this folder, uncomment the following line (if your hosting company will allow you to use OPTIONS):
# OPTIONS -Indexes -ExecCGI
于 2012-08-21T17:14:52.323 回答