[英]svg and svgz doesn't display after adding remove the trailing slash in .htaccess
Here is my .htaccess file 这是我的.htaccess文件
AddType image/svg+xml svg svgz
AddEncoding gzip svgz
Options +FollowSymlinks -MultiViews
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} /(.*[^/]+)/$ [NC]
RewriteRule .* /%1 [NC,L]
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME}.html -f
RewriteCond %{REQUEST_URI} !\.html [NC]
RewriteRule .* %{REQUEST_URI}.html [NC,L]
svg and svgz works fine if the web url format looks like www.myweb.com/index.html
and or www.myweb.com/index
如果网址格式看起来像
www.myweb.com/index.html
和/或www.myweb.com/index
则svg和svgz可以正常工作
But if the url looks like this way,(a trailing slash at the end of the url) www.myweb.com/index/
text contents are fine, but unable to see svg and svgz images! 但是,如果URL看起来像这样,(URL末尾的斜杠)
www.myweb.com/index/
文本内容就可以了,但是看不到svg和svgz图像! Must be the .htaccess is not quite right somewhere. 一定是.htaccess在某个地方不太正确。 If someone could help?
如果有人可以帮忙? Thanks!
谢谢!
This sounds like a relative/absolute URL issue. 这听起来像是相对/绝对URL问题。 If you're linking using relative links and you create an additional path node (the second
/
) which changes the relative URI base, and from that point, every relative URI will have /index/
appended to the front. 如果您使用相对链接进行链接,并且创建了一个额外的路径节点(第二个
/
)来更改相对URI基数,那么从这一点开始,每个相对URI都将/index/
附加在最前面。 You need to either change all of those URLs to absolute (start with a /
) or include a relative base in the page's header: 您需要将所有这些URL更改为绝对URL(以
/
开头),或在页面标题中包含相对基数:
<base href="/" />
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.