Mend broken links

I used to have a site (myoldsite.com) which hosted some files. However, I switched servers and have added myoldsite.com to the new server. Now the problem is, a lot of people still do not know that the site has switched servers, and that their old files arent on my new server.

They did not remove the links to the files, most of which are image files. How do I make it so that even if they use <img> to link to an image which is not there, a generic image will be displayed in place? Is this possible?

I have full control over this server.
lifegaugeAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

periwinkleCommented:
Hmmm - there's probably a lot of solutions.

The first one that comes to mind would be to write a 404 page so that if they come to a page that isn't defined, you can give them the sitemap or some other indication that the navigation has changed.

If all the images on the old site were in a certain directory, you could change the name of the directory on the new server, and then use mod_rewrite to rewrite any requests to image files in that directory to be to a default image, I suspect!  I'm not a heavily talented mod-rewrite person;  perhaps someone else can fill in the details.
0
andYetAnotherLoginNameCommented:
RewriteRule  ^/img/(.*)$   /img/replacement.gif  [L]
0
lifegaugeAuthor Commented:
andYetAnotherLoginName:

I'm not quite sure where to put " RewriteRule  ^/img/(.*)$   /img/replacement.gif  [L]"
0
periwinkleCommented:
In your configuration file, in the Virtualhost section for your domain.  You may need to add as well:

RewriteEngine On

However, I would suggest changing the name of the directory entirely, like:

 RewriteRule  ^/img/(.*)$   /images/defaultgraphic.gif  [L]



0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
andYetAnotherLoginNameCommented:
use http://httpd.apache.org/docs-2.0/mod/mod_rewrite.html#Solutions for both examples and complete reference.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Apache Web Server

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.