当前位置: 代码迷 >> 综合 >> 服务器配置 apache htaccess设置图片找到不到的默认图片
  详细解决方案

服务器配置 apache htaccess设置图片找到不到的默认图片

热度:40   发布时间:2024-02-25 04:59:27.0
<FilesMatch "\.(gif|jpg|jpeg|png)$">RewriteCond %{REQUEST_FILENAME} !-fRewriteRule ^(.*)$ ./no_find_image.jpg [QSA,PT]
</FilesMatch>

当请求的资源找不到后,都默认跳转到跟htaccess文件相同目录的no_find_image.jpg文件

整个htaccess文件代码

<FilesMatch "\.(gif|jpg|jpeg|png)$">RewriteCond %{REQUEST_FILENAME} !-fRewriteRule ^(.*)$ ./no_find_image.jpg [QSA,PT]
</FilesMatch>
<IfModule mod_rewrite.c>Options +FollowSymlinksRewriteEngine OnRewriteCond %{REQUEST_FILENAME} !-dRewriteCond %{REQUEST_FILENAME} !-fRewriteRule ^(.*)$ index.php/$1 [QSA,PT,L]
</IfModule>

 

  相关解决方案