I ended up creating a module and using the following code:
etc/frontend/events.xml
<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Event/etc/events.xsd">
<event name="controller_action_predispatch">
<observer name="controller_action_predispatch" instance="BB\BB\Observer\ControllerPredispatch" />
</event>
</config>
Observer/ControllerPredispatch.php
<?php
namespace BB\BB\Observer;
use Magento\Framework\Event\ObserverInterface;
use Magento\Framework\Event\Observer;
class ControllerPredispatch implements ObserverInterface
{
/**
* @var \Magento\Framework\UrlInterface
*/
protected $url;
/**
* @var \Magento\Framework\App\Response\Http
*/
protected $http;
/** @var \Magento\Customer\Model\Session */
protected $customerSession;
/**
* @param \Magento\Framework\UrlInterface $url
* @param \Magento\Framework\App\Response\Http $http
* @param \Magento\Customer\Model\Session $customerSession
*/
public function __construct(
\Magento\Framework\UrlInterface $url,
\Magento\Framework\App\Response\Http $http,
\Magento\Customer\Model\Session $customerSession
)
{
$this->url = $url;
$this->http = $http;
$this->customerSession = $customerSession;
}
/**
* Manages redirect
*/
public function execute(Observer $observer)
{
/**
* Check if user logged in
*/
if ($this->customerSession->isLoggedIn()) {
return;
}
if ($observer->getRequest()->getFullActionName() == 'cms_index_index') {
/**
* Redirect to login
*/
$this->http->setRedirect($this->url->getUrl('bb-check-extension.html'), 301);
}
}
}
Code is created by SR: Magento 2 : Redirect From Homepage to Login if not Logged