We quantitatively study the transport of E. coli near the walls of confined microfluidic channels, and in more detail along the edges formed by the interception of two perpendicular walls. Our experiments establish the connection between bacterial motion at the flat surface and at the edges and demonstrate the robustness of the upstream motion at the edges. Upstream migration of E. coli at the edges is possible at much larger flow rates compared to motion at the flat surfaces. Interestingly, the speed of bacteria at the edges mainly results from collisions between bacteria moving along this single line. We show that upstream motion not only takes place at the edge but also in an "edge boundary layer" whose size varies with the applied flow rate. We quantify the bacterial fluxes along the bottom walls and the edges and show that they result from both the transport velocity of bacteria and the decrease of surface concentration with increasing flow rate due to erosion processes. We rationalize our findings as a function of local variations in the shear rate in the rectangular channels and hydrodynamic attractive forces between bacteria and walls.