Rule #1: The UFC doesn't try to sell any more cards with just one worthwhile fight on them. If the co-main event can't be moved up it wasn't good enough to be a co-main in the first place.
Rule #2: Both main and co-main event have a replacement fighter assigned beforehand in case of injury. It would be that fighter's responsibility to be prepared to take the fight at a moment's notice, and the responsibility of the two fighters scheduled to appear on the card to be prepared for that fighter, as well as each other.*
Addendum #1: Backup fighters get paid enough to cover their expenses even if they don't end up fighting, and whenever possible should be juggled into the lineup of upcoming cards so their camp isn't wasted.
Addendum #2: For cards in which both main and co-main event are fought at the same weight class, one replacement fighter should be enough. (In freak situation in which two of the four fighters are injured at the least minute, the Co-main can be rescheduled. This should be ridiculously rare anyway.)
*I've been considering this since the recent clusterf***s at UFC 147 and 149, but those went on despite the ravaged lineups, so it seemed excessive. But once the UFC starts cancelling cards it seems it's time to start implementing contingency plans.