Hello. It is necessary on page 404 to remove the redirect. Any page can open as site.ru/page and the redikert will be on site.ru/page/ This is implemented in the controller via $ this-> middleware ('redirect'); but it is necessary that 404 be opened as it is written, without a redirect - site.ru/page123 and opened, and not as now site.ru/page123/ middleware code:
public function handle($request, Closure $next) { if (!preg_match('/.+\/$/', $request->getRequestUri())) { return Redirect::to( preg_replace("/\s{2,}/",'/', $request->getRequestUri() . "/" ), 301); } return $next($request); } All this works well, but on page 404 it needs to be removed. If there is no data, then transfer it to 404, I do it like this:
if (!$data) { App::abort(404); } How can I eliminate?