There's an expression "hard by", which I understand to mean "nearby", "close by". I don't know if it could be called an idiom, but it baffled me when I first encountered it in the translation of Historia Calamitatum (“the castle of Corbeil, which is hard by the city of Paris”). Back then I thought it an archaism, but since then I've encountered it in modern contexts, e.g. “In a bar hard by P.P. Layouts, Richard Hnatt sat sipping a Tequila Sour” (Philip Dick).
What's the origin of this expression? Etymonline mentions:
O.H.G. harto "extremely, very,"
in the etymology of 'hard', and I can see some connection, but it's vague.
Also, aside its rarity, can it be used interchangeably with "close by", or is there a small semantic difference I can't percieve?