Admin URL frontname is set to "admin" but on hitting the URL http://www.example.com/admin it redirects to localhost/admin
Working on localhost
web/secure/base_url
and web/unsecure/base_url
is set to http://localhost/sitename
Using Magento 2.1.8