【问题标题】:Bootstrap 3 glyphicons are 403 forbiddenBootstrap 3 字形图标被 403 禁止
【发布时间】:2014-09-07 02:06:01
【问题描述】:

我在 Wamp 2.5 (Win7) 上使用 Nette Framework 2.2.1 和 BootStrap 3。我无法在浏览器中加载字形图标(错误 403 Forbidden)。

浏览器看到的

所有需要的字体都在文件夹 C:\wamp\www\nette\www\fonts\

.htaccess 位于 C:\wamp\www\nette\www\ 有内容

<IfModule mod_autoindex.c>
    Options -Indexes
</IfModule>

# enable cool URL
<IfModule mod_rewrite.c>
    RewriteEngine On
    # RewriteBase /

    # prevents files starting with dot to be viewed by browser
    RewriteRule /\.|^\. - [F]

    # front controller
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule !\.(eot|svg|ttf|woff|pdf|js|ico|gif|jpg|png|css|rar|zip|tar\.gz)$ index.php [L]
</IfModule>

C:\wamp\www\nette\www\bootstrap.min.css 包含

@font-face{font-family:'Glyphicons Halflings';src:url(../fonts/glyphicons-halflings-regular.eot);src:url(../fonts/glyphicons-halflings-regular.eot?#iefix) format('embedded-opentype'),url(../fonts/glyphicons-halflings-regular.woff) format('woff'),url(../fonts/glyphicons-halflings-regular.ttf) format('truetype'),url(../fonts/glyphicons-halflings-regular.svg#glyphicons_halflingsregular) format('svg')}

Apache 错误日志:

[2014 年 7 月 16 日星期三 11:55:01.004757] [core:error] [pid 3812:tid 788](操作系统 5)访问被拒绝。 :[客户端 127.0.0.1:52031] AH00132:文件 权限拒绝服务器访问: C:/wamp/www/nette/www/fonts/glyphicons-halflings-regular.svg,引用者: http://www.nette.local/arts/porta-quis-ligula

我尝试为用户所有人设置文件夹字体的所有权限,但它仍然无法正常工作。

【问题讨论】:

    标签: php apache .htaccess glyphicons nette


    【解决方案1】:

    检查您的字体文件是否可以被运行 apache 的用户读取。

    除了它们所在的目录之外,字体文件本身的可读性也很重要。

    【讨论】:

      【解决方案2】:

      你在C:\wamp\www\nette\www\fonts中有字体,

      和 css 文件在同一文件夹 C:\wamp\www\nette\www 作为文件夹 fonts (C:\wamp\www\nette\ www\bootstrap.min.css )。

      但是在 css 文件中是 @font-face{font-family:'Glyphicons Halflings';src:url(../fonts/ ... 所以引导 css 需要文件夹中的所有字体 C:\wamp\www\nette\fonts(上一级)

      您可以将 css 文件移动到“C:\wamp\www\nette\www\styles”、“C:\wamp\www\nette\www\css”之类的文件夹中,这样字体的路径就会匹配或更改 css 文件中的路径。我推荐第一种方式。

      【讨论】:

        猜你喜欢
        • 2014-01-30
        • 2013-11-26
        • 1970-01-01
        • 2012-11-25
        • 1970-01-01
        • 2015-01-15
        • 2011-10-21
        • 2019-04-01
        相关资源
        最近更新 更多