问题描述
我正在测试一个在本地运行良好的网站,但是当我将其上传到Godaddy服务器时,我的SVG无法在浏览器中呈现.
I'm testing a website that has worked great locally however when I upload it to my godaddy server my SVG's are not rendering in browser.
经过一些网络搜索并获得技术支持,我才知道我需要在我的图像文件夹目录中配置一个.htaccess文件,才能正确显示SVG.
After some web searches and working with tech support I learned I need to have a .htaccess file configured in my image folder directory to correctly display SVG's.
有人可以让我知道如何为.htaccess创建,下载或复制和粘贴正确的数据吗?
Can someone please let me know how to create, download, or copy and paste the correct data for a .htaccess?
推荐答案
我想您的意思是设置适当的 Content-Type
标头. MIME类型显然是 image/svg + xml
,您可以使用 AddType 指令:
I guess you mean setting a proper Content-Type
header. The MIME type is apparently image/svg+xml
and you can use the AddType directive:
# Add one line for each extension
AddType image/svg+xml .svg
这篇关于如何创建.htaccess来显示SVG?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!