<?php
namespace FlexApp\EventSubscriber;
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
use Symfony\Component\HttpFoundation\RedirectResponse;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\HttpKernel\Event\RequestEvent;
class ImgLibSubscriber implements EventSubscriberInterface
{
public function onKernelRequest(RequestEvent $event)
{
$request = $event->getRequest();
if ($request->getHost() === 'adm.tile.expert' && strpos($request->getPathInfo(), '/import') === 0) {
$redirectUrl = 'https://aws-bi.tile.expert' . $request->getRequestUri();
$event->setResponse(new RedirectResponse($redirectUrl, Response::HTTP_TEMPORARY_REDIRECT));
}
}
public static function getSubscribedEvents()
{
return [
RequestEvent::class => 'onKernelRequest',
];
}
}