How to fix back button issue when using sidemenu

In my ionic project, i use side menu. when using side menu to go to another page ,then if i click back button the whole application is closed.but when open the pages from home page using button click back button work properly. how to fix it?