【发布时间】:2016-07-30 19:04:59
【问题描述】:
在纯基于客户端的网络应用程序中,我需要显示有时不存在的背景图像。当特定的 URL 模式返回 404 错误时,有没有办法“强制”Apache 提供图像?
可能返回 404 的 URL 模式是:
http://host/assets/user-images/xxxxx.jpg
我想在哪里提供图片:
http://host/assets/user-images/default.jpg
注意:
我已经使用了 .htaccess
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^ index.php [QSA,L]
【问题讨论】:
标签: apache .htaccess http-status-code-404 url-pattern