It’s quite easy to fetch Base URL for an Admin panel/Backend in Magento 2 using Backend module Url Class.
Back end Url have base store Url plus admin URI name. like {BASE_URL}/admin/
You can get Magento2 backend URL by just below way,
public function __construct( \Magento\Backend\Model\Url $backendUrlManager ) { $this->backendUrlManager = $backendUrlManager; } public function getBackendUrl() { return $this->backendUrlManager->getUrl('sales/order/view', ['param1' => 'param1']); }
We have passed Sales/order/view action with a query string as param1 in URL.
Get URL from an adminhtml template or PHP file,
echo $this->getBackendUrl();