Mend broken links

Posted on 2004-11-07
Last Modified: 2010-03-04
I used to have a site ( which hosted some files. However, I switched servers and have added 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.
Question by:lifegauge
    LVL 15

    Expert Comment

    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.
    LVL 3

    Expert Comment

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

    Author Comment


    I'm not quite sure where to put " RewriteRule  ^/img/(.*)$   /img/replacement.gif  [L]"
    LVL 15

    Accepted Solution

    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]

    LVL 3

    Assisted Solution

    use for both examples and complete reference.

    Featured Post

    Highfive + Dolby Voice = No More Audio Complaints!

    Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

    Join & Write a Comment

    Suggested Solutions

    Introduction As you’re probably aware the HTTP protocol offers basic / weak authentication, which in combination with the relevant configuration on your web server, provides the ability to password protect all or part of your host.  If you were not…
    It is possible to boost certain documents at query time in Solr. Query time boosting can be a powerful resource for finding the most relevant and "best" content. Of course the more information you index, the more fields you will be able to use for y…
    To add imagery to an HTML email signature, you have two options available to you. You can either add a logo/image by embedding it directly into the signature or hosting it externally and linking to it. The vast majority of email clients display l…
    Sending a Secure fax is easy with eFax Corporate ( First, Just open a new email message.  In the To field, type your recipient's fax number You can even send a secure international fax — just include t…

    728 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    17 Experts available now in Live!

    Get 1:1 Help Now