【发布时间】:2012-07-23 12:36:12
【问题描述】:
我在 Centos 5 上运行 Apache,我想实现重写规则。当用户尝试访问文件夹/var/site.com/html/image/products/ 中的图像时,规则应检查图像是否存在,如果不存在,我希望显示/var/site.com/html/image/defaultimage.jpg
我尝试将其放入位于/var/site.com/html/image/products/ 的 .htaccess 中,但没有成功
RewriteEngine on
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_URI} \.(gif|jpg|jpeg|png)$
RewriteRule .* /var/site.com/html/image/defaultimage.jpg [L]
【问题讨论】:
标签: apache mod-rewrite centos