In the following pictures, the Esp8266's Rx is connected to the Uno's Rx.

@Richard_Vowles actually, if i want to program the esp8266 with arduino ide, do i have to do anything with its firmware ?

@garmisch_wong no, if you add the esp8266 features through Board Manager then any code you write through the arduino IDE replaces the firmware on the esp. the bootloader is built into the rom so you dont have to worry about damaging that. now you can replace the crude AT command firmware with whatever custom software you like. I dont even bother with the Uno boards any more, there are esp8266 boards with more IO pins like the wemos d1 mini.