I have found a literature (Lang 1995) state that in acidic medium or without catalyst, the reaction will occur at (N-) while in alkaline medium, alcoholate anion will reactive and replacement tendency to occur at (O-).
But, in my observations, the reaction occur can be according to Lang 1995 and also inverse in both of medium.