gpt4 book ai didi

php - Azure 上 codeigniter 应用程序的 css 文件中的字体路径显示 404?

转载 作者:行者123 更新时间:2023-11-28 02:37:10 26 4
gpt4 key购买 nike

我正在 Azure 上运行我的 PHP codeigniter 应用程序。

在我的css中,我将字体路径设置如下

@font-face {
font-family: Sample1-Light;
src: url('../fonts/Sample1/Sample1-Light.otf');
}

上面的代码在我的本地主机上运行良好,但是一旦我把它放在 Azure 上,它就会显示 404 错误

http://samplewebsite1.azurewebsites.net/Helloworld/assets/fonts/Sample1/Sample1-Light.otf 404 (Not Found)

我的“字体”文件夹位于 Assets 文件夹(“ Assets /字体”)中,而 css 文件位于 Assets 文件夹(“ Assets /css”)中的 css 文件夹中。

最佳答案

如果应用程序的根目录中不存在 web.config 文件,您需要创建一个文件并将以下内容放入其中:

<?xml version="1.0" encoding="UTF-8" ?>
<configuration>
<system.webServer>
<staticContent>
<remove fileExtension=".otf" />
<mimeMap fileExtension=".otf" mimeType="application/font-sfnt" />
</staticContent>
</system.webServer>
</configuration>

关于php - Azure 上 codeigniter 应用程序的 css 文件中的字体路径显示 404?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47361950/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com