Jump to content

[SOLVED] Replace image not found icon


tpl41803

Recommended Posts

I'm wondering if there's any way to replace the "X" icon that shows up when an image is not found on a webpage with a default image.

 

I'm assuming that if this is possible it would be done in CSS

 

I ran a few google searches and looked around breifly on the forms, but I have no idea what to actually search for, CSS Image Not Found Icon  doesn't produce the results im looking for

 

thanks

Link to comment
Share on other sites

in your images folder, create a file called .htaccess (make sure you get that period at the front of the filename) and use this in it:

RewriteEngine On
# Relative URL to the images folder
RewriteBase /images #This assumes it's http://host.com/images/
# Don't change files & folders that exist already
RewriteCond %{REQUEST_FILENAME} !-f [NC]
RewriteCond %{REQUEST_FILENAME} !-d [NC]
# Show the default if it doesn't exist
RewriteRule ^(.+)$ default.jpg # Add a [R] after the filename if you want an actual redirect (instead of a rewrite)

Link to comment
Share on other sites

  • 4 weeks later...

you know... I got it working, but when i tried to log back into my file manager, i get an access denied 403 error--

 

i removed the code i added and the error went away, so i'm not sure what the problem is that's causing this.

 

my entire .htaccess file looks like this:

Options -Indexes
ErrorDocument 401 /customerrors/error_401.php
ErrorDocument 403 /customerrors/error_403.php
ErrorDocument 400 /customerrors/error_400.php
ErrorDocument 500 /customerrors/error_500.php
ErrorDocument 404 /customerrors/error_404.php

RewriteEngine On
RewriteBase /image
RewriteCond %{REQUEST_FILENAME} !-f [NC]
RewriteCond %{REQUEST_FILENAME} !-d [NC]
RewriteRule ^(.+)$ noimg.jpg

 

when i remove everything from "rewriteEngine..." down i have no problems--I'm just not familiar enough with .htaccess to figure out what the problem code is.

 

thanks :-D

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.