$objectManager = \Magento\Framework\App\ObjectManager::getInstance();
$storeManager = $objectManager->get('\Magento\Store\Model\StoreManagerInterface');
echo $storeManager->getStore()->getBaseUrl();exit;
This only gives the frontend base URL. How to get admin side URL?
Best Answer
You can use following code directly in your phtml file to get admin URL.