Strangely enough, they would write the rats a letter.
It's true. In the 19th century if someone's house was infested with rats the owner would write the rodents a strongly worded letter, commanding them to leave (and maybe go to a neighbor's house instead). Once the letter was written it would be covered in grease to attract the rats' attention, and then stuck in the cellar wall.
B.A. Botkin's A Treasury of New England Folklore contains the text of actual letters that were found in old houses. For example, a Mrs. Weed of East Sandwich New Hampshire wrote the following missive on May 9th, 1845:
"I have bourn with you till my patience is all gone. I cannot find words bad enough to express what I feel, you black devils you are, gnawing our trace corn while we are asleep! And even when we are awake you have the audacity to set you infernal jaws to going. Now, spirits of the bottomless pit, depart from this place with all speed. Look not back! Begone or you are ruined! ... Unless you want your detested garments dyed in fire and brimstone, you satans, quit here and go to Ike Nute's!...
A letter found in Maine was written on October 31, 1888, and takes a less fiery approach.
"Messrs. Rats and Co., - Having taken quite a deep interest in your welfare in regard to your winter quarters I thought I would drop you a few lines which might be of considerable benefit to you in the future ... I wish to inform you that you will be very much disturbed during cold winter months as I am expecting to be at work through all parts of the house, shall take down ceilings, take up floors and clean out every substance that would serve to make you comfortable ... I will here here refer you to the farm of (name omitted), No. 6 Incubator Street, where you will find a splendid cellar well filled with vegetations of (all) kinds besides a shed leading to a barn, with a good supply of grain, where you can live snug and happy. Shall do you no harm if you heed to my advice; but if not, shall employ 'Rough on Rats.'"It's interesting the second letter was written on Halloween. Maybe it's a good night to communicate not just with ghosts, but with rats!
I'm not sure if the hellfire letter or the gently persuasive one was more effective. I suppose a scientific experiment would tell us, but I'll let someone else conduct it. If I get rats I'm just going straight to "Rough on Rats."