@fontface - zen 购物车中的 403 禁止错误
Posted
技术标签:
【中文标题】@fontface - zen 购物车中的 403 禁止错误【英文标题】:@fontface - 403-forbidden error in zen cart 【发布时间】:2012-08-16 20:47:29 【问题描述】:我不确定这是否是发布此内容的正确位置,因为我不知道问题出在哪里。基本上字体现在对我来说真的很痛苦,而且没有任何效果。我尝试从 google-fonts 加载字体并遇到 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"
我尝试使用权限来授予对文件的读取和执行权限,甚至尝试过 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
任何想法我在这里做错了什么 - 任何帮助/想法都非常感谢?
【问题讨论】:
fonts
目录上设置的权限呢?
同理,我对字体目录和文件设置了相同的权限
使用什么网络服务器?抱歉,无法检查您直接提供的这些网址,因此是个愚蠢的问题。 )
更具体地说,服务器配置中是否提供了某种these directives?
服务器是 apache2 - 请参阅上面有关 .htaccess 的更改 - 这是正确的吗? - 仍然无法正常工作
【参考方案1】:
感谢我的托管服务提供商,我已经找到了问题所在,我将尽我所能将信息传递给遇到相同问题的任何其他人: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
【讨论】:
以上是关于@fontface - zen 购物车中的 403 禁止错误的主要内容,如果未能解决你的问题,请参考以下文章