上传到不同服务器后网站字体停止工作

website font stop working after upload on different server

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

@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;
}

我想我发现了你的问题:http://trzydewizje.com/ud/font/

trzydewizje.com/ud/font/SegoeCondensed.woff Failed to load resource: the server responded with a status of 404 (Not Found)

trzydewizje.com/ud/font/SegoeCondensed.ttf Failed to load resource: the server responded with a status of 404 (Not Found)

至少在您在评论中发布的错误中,您正在尝试 link 到 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 in-browser 进行了检查,更改文件名解决了您的问题:

@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;
}