I am trying to get the base url of my website.
But not matter what I try,I only get https://127.0.0.1/magento
I want to get https://127.0.0.1
I tried
$this->_storeManager->getStore()->getBaseUrl(\Magento\Framework\UrlInterface::URL_TYPE_WEB)
and all the associated techniques with object manage but always give the same result.
namespace Vendor\Module\Block;
use Magento\Framework\View\Element\Template;
use Magento\Framework\View\Element\Template\Context;
//use Vendor\Module\Model\FidoServiceFactory;
use Magento\Customer\Model\Session;
class Register extends Template
{
private $fidoCallerFactory;
private $session;
// public function __construct(Context $context, FidoServiceFactory $fidoServiceFactory, Session $session) {
// parent::__construct($context, []);
// $this->fidoServiceFactory = $fidoServiceFactory;
// $this->session = $session;
// }
//
// #Returns the base URL of currently visited store.
public function getBaseUrl() {
// console.log($this->_storeManager->getStore()->getBaseUrl());
$objectManager = \Magento\Framework\App\ObjectManager::getInstance();
$storeManager = $objectManager->get('\Magento\Store\Model\StoreManagerInterface');
return $this->_storeManager->getStore()->getBaseUrl(\Magento\Framework\UrlInterface::URL_TYPE_LINK);
//return "http://127.0.0.1";
}