@fontface - zen cart中的403-forbidden错误

时间:2012-08-21 13:32:01

标签: html css fonts permissions zen-cart

我不确定这是否是发布此内容的正确位置,因为我不知道问题出在哪里。基本上字体对我来说是一个真正的痛苦,没有任何工作。我已经尝试从谷歌字体加载字体并遇到IE的问题所以我决定下载它们并自己提供它们但现在它不能在任何浏览器中工作我收到错误:

“NetworkError:403 Forbidden - http://www.mychic.co.uk/includes/templates/SmartStart/fonts/architectsdaughter-webfont.woff” “NetworkError:403 Forbidden - http://www.mychic.co.uk/includes/templates/SmartStart/fonts/architectsdaughter-webfont.ttf

我尝试过使用permisssions来提供对文件的读取和执行权限,甚至尝试过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文件,以便我将以下内容添加到网站的根目录和fonts目录中(这是正确的):

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

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

1 个答案:

答案 0 :(得分:6)

由于我的托管服务提供商,我已经找到了问题所在,我会尽可能地为其他人提供相同问题的信息:zencart已在includes文件夹中包含一个阻止某些文件的.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