Issue: when you upload your wordpress site to server and import your DB, then opening your site url redirect to localhost domain. e.g; http://www.sample.com/mywordpress redirects to http://localhost/mywordpress.
Solution: When you upload your site with import db from your localhost, not configuring it on the server. wp-options,table, has the information to where to redirect it, so what you need delete all tables from your server DB except wp-options and export all tables from your localhost DB except wp-options then import these tables to your server DB.