diff --git a/app/Http/Controllers/Gallery/AlbumController.php b/app/Http/Controllers/Gallery/AlbumController.php index b705e1a..83909bb 100644 --- a/app/Http/Controllers/Gallery/AlbumController.php +++ b/app/Http/Controllers/Gallery/AlbumController.php @@ -22,8 +22,9 @@ class AlbumController extends Controller $album = DbHelper::getAlbumByPath($albumUrlAlias); if (is_null($album)) { - // Check redirects - $redirect = AlbumRedirect::where(DB::raw('\'/a\' + source_url'), $request->path())->first(); + // Check redirects (remove the first 'a' at the beginning - e.g. "a/Florida-2015" => "/Florida-2015" + $requestPath = preg_replace('/^a/', '', $request->path()); + $redirect = AlbumRedirect::where('source_url', $requestPath)->first(); if (is_null($redirect)) {