@Override
    protected void channelRead0(ChannelHandlerContext ctx, HttpRequest req) throws Exception {
        String requestHTTP = req.getUri();
        if (requestHTTP.contains("redirect?url=")) { //check if contains required characters
            String [] requestArray = requestHTTP.split("/?url=");
            String urlToRedirect = requestArray[1];
            if (!urlToRedirect.startsWith("http")) {
                urlToRedirect = "http://" + urlToRedirect;
            }
            FullHttpResponse fullHttpResponse = new DefaultFullHttpResponse(HTTP_1_1, FOUND);
            fullHttpResponse.headers().set(LOCATION, urlToRedirect);
            ctx.writeAndFlush(fullHttpResponse).addListener(ChannelFutureListener.CLOSE);
            String url = req.getUri();
            controller.IncreaseCount();
            controller.addToIpMap(ctx);
            controller.addToConnectionDeque(ctx, url);
            StatisticsController.processRedirectRequest(urlToRedirect);
        } else {
            ctx.fireChannelRead(req);
        }
    }