User agents such as browsers use media types to determine how the content should be processed. When a svg image is not served with correct MIME type in the content type header, It might not rendered as intended by the author. For example, A browser might render the svg image as plain text instead of rendering the image.

The MIME type set for svg images is "image/svg+xml" and the file extensions are "*.svg". So if your svg image file not being served correctly(Content-Type:"image/svg+xml"), You have to correct it.There are various methods available to do this, but one of the easiest way is to use ".htaccess" file.

In the htaccess file we can associate the svg image extensions with the correct MIME type. To do that, Add the following line of code to the htaccess file and it will start display the svg images correctly.
RewriteEngine on
AddType image/svg+xml svg svgz
AddEncoding gzip svgz


Comments (0)
Leave a Comment

loader Posting your comment...