Mend broken links

Posted on 2004-11-07
Medium Priority
Last Modified: 2010-03-04
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.
Question by:lifegauge
  • 2
  • 2
LVL 15

Expert Comment

ID: 12524302
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.

Expert Comment

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

Author Comment

ID: 12561364

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

Accepted Solution

periwinkle earned 200 total points
ID: 12561473
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]


Assisted Solution

andYetAnotherLoginName earned 200 total points
ID: 12563164
use http://httpd.apache.org/docs-2.0/mod/mod_rewrite.html#Solutions for both examples and complete reference.

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In Solr 4.0 it is possible to atomically (or partially) update individual fields in a document. This article will show the operations possible for atomic updating as well as setting up your Solr instance to be able to perform the actions. One major …
The title says it all. Writing any type of PHP Application or API code that provides high throughput, while under a heavy load, seems to be an arcane art form (Black Magic). This article aims to provide some general guidelines for producing this typ…
this video summaries big data hadoop online training demo (http://onlineitguru.com/big-data-hadoop-online-training-placement.html) , and covers basics in big data hadoop .
Despite its rising prevalence in the business world, "the cloud" is still misunderstood. Some companies still believe common misconceptions about lack of security in cloud solutions and many misuses of cloud storage options still occur every day. …
Suggested Courses
Course of the Month16 days, 13 hours left to enroll

862 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