Skip to content

Commit 0ef82e2

Browse files
committed
Fix up empty to
1 parent 12b2f8e commit 0ef82e2

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/Http/Middleware/RedirectsMiddleware.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,12 @@ public function handle($request, Closure $next, ...$guards)
1515
$redirect = Entry::query()
1616
->where('collection', 'redirects')
1717
->where('title', $url)
18+
->where('published', true)
1819
->first();
1920

20-
if (!$redirect)
21+
if (! $redirect || ! $redirect->to) {
2122
return $next($request);
23+
}
2224

2325
return redirect($redirect->to, $redirect->get('code') ?? 302);
2426
}

0 commit comments

Comments
 (0)