【问题标题】:website font stop working after upload on different server网站字体在不同服务器上上传后停止工作
【发布时间】:2016-01-12 20:13:09
【问题描述】:

我最近为我的客户建立了一个网站,但遇到了问题。当我在我的服务器(apache)上上传时一切正常,但是当我的客户端将它上传到他的服务器时(我还不知道什么操作系统),字体停止正常工作。相同的文件,相同的代码,与浏览器无关。有任何想法吗?

@font-face {
font-family: 'xxx';
src: url('xxx.eot');
src: url('xxx.eot?‪#‎iefix‬') format('embedded-opentype'),
url('xxx.woff') format('woff'),
url('xxx.ttf') format('truetype'),
url('xxx.svg#xxx') format('svg');
font-weight: normal;
font-style: normal;
}

【问题讨论】:

  • 可能与他们服务器上设置的 mime 类型有关。
  • 您意识到您还必须将字体文件上传到新服务器,对吧?您是否已将xxx.eotxxx.woffxxx.ttfxxx.svg 添加到新服务器?
  • 是的,当然,我们首先检查文件是否正常
  • 控制台说什么?该网站是否存在于任何地方?
  • 我无权访问我的客户端服务器,因此无法检查控制台。我认为这是关于服务器设置的混乱。我认为服务器支持应该对此有所帮助...

标签: css apache fonts server font-face


【解决方案1】:

我想我找到了你的问题:http://trzydewizje.com/ud/font/

trzydewizje.com/ud/font/SegoeCondensed.woff资源加载失败:服务器响应状态为404(未找到)

trzydewizje.com/ud/font/SegoeCondensed.ttf资源加载失败:服务器响应状态为404(未找到)

至少在您在 cmets 中发布的错误中,您尝试链接到 SegoeCondensed.woff,而实际文件都是小写的,例如 segoecondensed.woff

为了验证这一点,我访问了您添加字体的样式表 (http://trzydewizje.com/ud/font/stylesheet.css),这似乎是问题所在:

@font-face {
    font-family: 'Segoe Condensed';
    src: url('SegoeCondensed.eot');
    src: url('SegoeCondensed.eot?#iefix') format('embedded-opentype'),
        url('SegoeCondensed.woff') format('woff'),
        url('SegoeCondensed.ttf') format('truetype'),
        url('SegoeCondensed.svg#SegoeCondensed') format('svg');
    font-weight: normal;
    font-style: normal;
}

我通过编辑浏览器中的 css 进行了检查,并更改了文件名解决了您的问题:

@font-face {
    font-family: 'Segoe Condensed';
    src: url('segoecondensed.eot');
    src: url('segoecondensed.eot?#iefix') format('embedded-opentype'),
        url('segoecondensed.woff') format('woff'),
        url('segoecondensed.ttf') format('truetype'),
        url('segoecondensed.svg#SegoeCondensed') format('svg');
    font-weight: normal;
    font-style: normal;
}

【讨论】:

  • 哈哈就是这样。我的客户用来上传文件的程序更改了文件名中的字母。谢谢;)
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2015-04-14
  • 1970-01-01
  • 1970-01-01
  • 2019-12-18
  • 1970-01-01
相关资源
最近更新 更多