简体   繁体   English

Apache提供一些带有html内容的图像

[英]Apache serving some images with html content

So I come in to work today to find that some of my images aren't being served into the img elements properly. 因此,我今天上班来发现我的某些图像未正确送入img元素。 The path is fine and the requests are returning 200 but the images themselves are blank. 路径正常,请求返回200但图像本身为空白。

When I open the image address directly in the browser (ie: http://www.example.com/images/image.png , the page loads with a bunch of unstyled html as if I had requested a page, not an image. The html is from pages related to the image, but there is nowhere in that request that I am specifying a page. It's as if the image is being served as an html document instead of an image. Is this a server setting or something? 当我直接在浏览器中打开图像地址(即: http://www.example.com/images/image.png : http://www.example.com/images/image.png ,页面加载了一堆未样式化的html,就好像我请求的是页面,而不是图像。 html来自与图像相关的页面,但是在请求中我没有指定页面。就好像图像被作为html文档而不是图像一样。这是服务器设置还是其他?

So I had some dodgy rewrite rules in my .htaccess file which was matching part of the string of the image filename, and internally redirecting to a page but serving it all messed up because of my dodgy .htaccess . 所以我在.htaccess文件中有一些躲闪的重写规则,该规则与图像文件名的字符串的一部分匹配,并且内部重定向到页面,但由于我的躲闪性.htaccess而使页面全乱了。 Solved the problem by making the .htaccess rules more regulated. 通过使.htaccess规则更加规范来解决此问题。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM