I'm posting this question again since all the existing related posts are pretty old! I am completely new to Magento and I had just started to change a few config settings when I started to get a 404 on the admin. Site loads fine it's the admin I have issues with. I was setting up stores fine but I changed a Base URL (secure) saved and got a 404 afterwards. I have no idea whatsoever how to fix this and I need my admin back! I appreciate all the help I can get! Thanks,
Open you Database in phpmyadmin and then select your DB there and run this query there.
UPDATE `core_config_data` SET `value` = '0' WHERE `core_config_data`.`path` = 'web/secure/use_in_adminhtml';
After this please run below commands to clear cache..
php bin/magento cache:clean php bin/magento cache:flush
That's it. After doing this you can open your admin page.
Hope this will help you!