相关疑难解决方法(0)

如果不存在图像,则显示默认图像

我在Centos 5上运行Apache,我想实现重写规则.当用户尝试访问文件夹中/var/site.com/html/image/products/的图像时,规则应该检查图像是否存在,如果不存在,我想要/var/site.com/html/image/defaultimage.jpg显示

我试着将它放在.htaccess中, /var/site.com/html/image/products/但它没有用

RewriteEngine on
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f 
RewriteCond %{REQUEST_URI} \.(gif|jpg|jpeg|png)$ 
RewriteRule .* /var/site.com/html/image/defaultimage.jpg [L]
Run Code Online (Sandbox Code Playgroud)

apache mod-rewrite centos

2
推荐指数
1
解决办法
1959
查看次数

标签 统计

apache ×1

centos ×1

mod-rewrite ×1