This problem - aptly labelled link rot - is a problem on Stack Exchange which cannot be solved easily in general. As such, it's best handled on a case-by-case basis.
The best would be to comment on the post (thereby notifying the author) and request an update of the information. Such an update should - in the very least - separate the content from the link, making the post self-contained.
Prevention is better than the cure though. Therefore, rather than posting
... See, for example, http://link/that/has/rotted. ...
without mentioning the details contained in http://link/that/has/rotted, it would be far better to use
... from this reference on something, we have
stuff from the original reference.
In the above case, when the link grown stale, an edit to remove the reference still leaves the post relevant.
A really round-about way of correcting the problem after-the-fact is to attempt finding the lost content on the Internet Archive (known as Wayback Machine). If the rotted content was somehow archived, one could hopefully find some relevant content and restore the post to a usable state.
One way of avoiding link rot for images is to use the dedicated image-upload dialoguse the dedicated image-upload dialog. This will ensure that images reside with SE's account on IMGUR, where they remain indefinitely.