You need to use the .htaccess to direct access to domain to url specified in config.php

See

301 Redirect - How to create Redirects


Follow the "Redirect to www" on the page if url given in config.php have www in it.