Home php教程 PHP开发 The solution to the problem that the Bootstrap framework cannot display the woff font properly after the website is published

The solution to the problem that the Bootstrap framework cannot display the woff font properly after the website is published

Dec 05, 2016 pm 02:02 PM
bootstrap

After publishing the website to IIS, I found that the woff font referenced by the Bootstrap framework used by the website could not be displayed properly. So I traced the http request and found that the woff font request had a GET .woff 404 (Not Found) problem, but the woff font file in the project was not lost. After investigation, it turned out that IIS on the server did not add the MIME type of woff font, which caused IIS to be unable to process and recognize files of this type when sending HTTP requests.

Solution 1: Add the MIME type of woff font in the Web.config configuration file

Liberation method 2: Add the MIME type of woff font in IIS
Woff font introduction
MIME type introduction

Solution one: Add the MIME type of the woff font in the Web.config configuration file

If the website is written using ASP.NET or ASP.NET MVC, you can easily use the configuration file to configure the woff font directly. Just add the following configuration to the system.webServer node in Web.config.

<system.webServer>
<staticContent>
 <remove fileExtension=".woff" />
 <mimeMap fileExtension=".woff" mimeType="font/x-font-woff" /> 
</staticContent>
</system.webServer>
Copy after login

What you need to pay attention to here is this configuration. Adding this node is to prevent this error: "When the unique key attribute "fileExtension" is set to ".woff", the type "mimeMap" cannot be added. Duplicate collection items", you can click this link to view the solution to this problem. If you only add the following node and no error is reported, the remove node does not need to be added. In addition, "font/x-font-woff" is the MIME type value of the woff font.

After adding this node to the configuration file of the website, the woff font can be displayed normally when the website is reopened. This method can be used as a solution when you do not have permission to operate the IIS manager.

Liberation plan two: Add the MIME type of woff font in IIS

If you can directly operate the IIS manager, you can also add the mime type of woff font directly on IIS. Just open the current IIS, open the MIME type configuration, and finally add a new MIME type. The extension of the woff font here is .woff, and the MIME type is: "font/x-font-woff". The specific operations are as follows:

Open the IIS manager in the control panel, select the current IIS, and open the MIME type configuration;

Add a .woff screenshot in IIS;

Click the add function in the operation column to the right of the MIME type;

Add a screenshot of the MIME type of .woff;

In the pop-up Add MIME type dialog box, fill in .woff as the file extension, and fill in font/x-font-woff or application/x-font-woff as the MIME type;

Settings File extension and type;

After clicking OK, the MIMI TYPE with the .woff extension was successfully added. Now when you open the website to request the WOFF font, there will be no 404 NOT FOUND error.

Introduction to woff font

Web Open Font Format (WOFF) is a font format standard used by web pages. This font format was developed in 2009 and is now being standardized by the World Wide Web Consortium's Web Font Working Group to become a recommended standard. This font format not only effectively uses compression to reduce file size, but also does not contain encryption and is not subject to DRM (Digital Rights Management) restrictions.

After the Mozilla Foundation, Opera Software and Microsoft submitted WOFF on April 8, 2010, the World Wide Web Consortium commented that it hoped that WOFF would soon become a "single, interoperable (font) supported by all browsers" )Format". [6] On July 27, 2010, the World Wide Web Consortium released WOFF as a working draft.

The MIME type of WOFF is: application/x-font-woff (font/x-font-woff is also acceptable). This MIME type is not available by default in IIS7. If you want the website to support this, please set the MIME in IIS7 Add woff in the type.

Introduction to MIME types

MIME (Multipurpose Internet Mail Extensions) is a multipurpose Internet mail extension type, which is a type that sets a file with a certain extension to be opened by an application. When the file with the extension is accessed , the browser will automatically use the specified application to open. It is mostly used to specify some client-defined file names and some media file opening methods.


Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

AI Hentai Generator

AI Hentai Generator

Generate AI Hentai for free.

Hot Article

R.E.P.O. Energy Crystals Explained and What They Do (Yellow Crystal)
1 months ago By 尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. Best Graphic Settings
1 months ago By 尊渡假赌尊渡假赌尊渡假赌
Will R.E.P.O. Have Crossplay?
1 months ago By 尊渡假赌尊渡假赌尊渡假赌

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

How to get the bootstrap search bar How to get the bootstrap search bar Apr 07, 2025 pm 03:33 PM

How to use Bootstrap to get the value of the search bar: Determines the ID or name of the search bar. Use JavaScript to get DOM elements. Gets the value of the element. Perform the required actions.

How to use bootstrap in vue How to use bootstrap in vue Apr 07, 2025 pm 11:33 PM

Using Bootstrap in Vue.js is divided into five steps: Install Bootstrap. Import Bootstrap in main.js. Use the Bootstrap component directly in the template. Optional: Custom style. Optional: Use plug-ins.

How to do vertical centering of bootstrap How to do vertical centering of bootstrap Apr 07, 2025 pm 03:21 PM

Use Bootstrap to implement vertical centering: flexbox method: Use the d-flex, justify-content-center, and align-items-center classes to place elements in the flexbox container. align-items-center class method: For browsers that do not support flexbox, use the align-items-center class, provided that the parent element has a defined height.

How to write split lines on bootstrap How to write split lines on bootstrap Apr 07, 2025 pm 03:12 PM

There are two ways to create a Bootstrap split line: using the tag, which creates a horizontal split line. Use the CSS border property to create custom style split lines.

How to resize bootstrap How to resize bootstrap Apr 07, 2025 pm 03:18 PM

To adjust the size of elements in Bootstrap, you can use the dimension class, which includes: adjusting width: .col-, .w-, .mw-adjust height: .h-, .min-h-, .max-h-

How to set up the framework for bootstrap How to set up the framework for bootstrap Apr 07, 2025 pm 03:27 PM

To set up the Bootstrap framework, you need to follow these steps: 1. Reference the Bootstrap file via CDN; 2. Download and host the file on your own server; 3. Include the Bootstrap file in HTML; 4. Compile Sass/Less as needed; 5. Import a custom file (optional). Once setup is complete, you can use Bootstrap's grid systems, components, and styles to create responsive websites and applications.

How to insert pictures on bootstrap How to insert pictures on bootstrap Apr 07, 2025 pm 03:30 PM

There are several ways to insert images in Bootstrap: insert images directly, using the HTML img tag. With the Bootstrap image component, you can provide responsive images and more styles. Set the image size, use the img-fluid class to make the image adaptable. Set the border, using the img-bordered class. Set the rounded corners and use the img-rounded class. Set the shadow, use the shadow class. Resize and position the image, using CSS style. Using the background image, use the background-image CSS property.

What to do if the Bootstrap Table uses AJAX to get data garbled What to do if the Bootstrap Table uses AJAX to get data garbled Apr 07, 2025 am 11:54 AM

Solutions to the garbled code of Bootstrap Table when using AJAX to obtain data from the server: 1. Set the correct character encoding of the server-side code (such as UTF-8). 2. Set the request header in the AJAX request and specify the accepted character encoding (Accept-Charset). 3. Use the "unescape" converter of the Bootstrap Table to decode the escaped HTML entity into original characters.

See all articles