How to fix 'woff and ttf fonts 404 not found'
By FoxLearn 2/18/2024 12:58:45 AM 504
"Failed to load resource: the server responded with a status of 404 (Not Found)" or "woff2?v=4.3.0 Failed to load resource" with fontawesome-webfont.woff, fontawesome-webfont.woff2, glyphicons-halflings-regular.woff, glyphicons-halflings-regular.woff2.
If you haven't got files, i think you should download then copy to your project. First ensure that you copy all files to webserver, In Visual Studio you can click each of file then select properties->copy always
Second you need to open the Web.config file then add a config as below
<staticContent> <remove fileExtension=".woff" /> <mimeMap fileExtension=".woff" mimeType="application/font-woff" /> <remove fileExtension=".woff2" /> <mimeMap fileExtension=".woff2" mimeType="font/x-woff" /> </staticContent>
Now, Start your project again then select inspect->tab network you can see no error throw a 404 not found error on woff or woff2 files when requesting the .woff, .ttf, .woff2 files
- What is HSTS
- HTML5 Validation for ASP.NET Core
- Using HTML Range Inputs with ASP.NET Core TagHelpers
- Using HTML DataList with ASP.NET Core
- How to Use Conditional Middleware in ASP.NET Core
- How to use the FromServices attribute in ASP.NET Core
- How to use the Developer Exception Page in ASP.NET Core
- How to Implement authorization for Swagger in ASP.NET Core