The hydraulic disc brake on the rear of my bike is rubbing quite badly, even after trying to realign the caliper. The caliper is as far over on the mounts as it can be and the rubbing still persists. I'm thinking about possibly trying to shim the rotor to get it to realign and was wondering if that was a good idea or not.
There are times when a brake mount is not ideally located and shimming under a rotor is the only solution. The ideal thing to use are precision ground washers/shims, since the nature of a rotor is small differences in the mounting area will amplify into out of true spots. You can get these in M5 for 6-bolt from industrial suppliers etc, and some bike companies make centerlock ones.
Try to do it by the least amount you can, since doing it at all increases the risk of issues with the bolts loosening. Under about 0.5mm is pretty inconsequential.
This should only ever be done after you've retracted the inner piston(s) all the way, and the brake can't center properly. Also make sure the problem isn't that something on the hub is put together wrong, i.e. if the problem were to arise after doing something with the hub internals.
Sometimes calipers have piston mobility problems that lead people to try this as a way of limping the caliper along, which may work as a stopgap.