Admin url redirecting to localhost/admin
First change from
http://localhost/sitename
to
http://127.0.0.1/sitename/
second, after doing this remove var/cache folder.
Check your Baseurl and Baseurl secure
Change From :-
localhost
To :-
127.0.0.1
Then Run This Command :-
sudo php bin/magento cache:flush
sudo php bin/magento cache:clean