404 图像占位符
我正在开发一个产品库,刚刚进行了导入。这添加了一堆对服务器上不存在的图像的引用。
现在,当图像尝试加载时,它会出现损坏的图像图标,这很丑陋,而且应该更好地处理。
理想情况下,每当显示损坏的图像时(也就是说,当图像的路径不存在时),我希望 Apache 显示占位符图像。
有没有办法通过 .htaccess 做到这一点?
I've got a product gallery I'm working on and just did an import. This added a bunch of references to images that don't exist on the server.
Right now when the image tries to load, it's got that broken image icon, which is ugly, and well, should be handled better.
Ideally, whenever a broken image would be displayed -- that is to say when an image's path just doesn't exist -- I would like Apache to show a placeholder image instead.
Is there any way to do this via .htaccess?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
使用
RewriteCond
和-f
来检查文件是否存在,例如:Use
RewriteCond
with-f
to check if the file exists, e.g.: