Skip to content

Commit 09db676

Browse files
authored
Fix bug on main page
1 parent 3acdd92 commit 09db676

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

UrlWithoutSlash.php

+2-4
Original file line numberDiff line numberDiff line change
@@ -16,16 +16,14 @@ class UrlWithoutSlash
1616
*/
1717
public function handle($request, Closure $next)
1818
{
19-
20-
if(mb_substr($request->getPathInfo(),-1)=='/' && ($uri = $request->getRequestUri())!='/'){
19+
if(mb_substr($request->getPathInfo(),-1)=='/' and $request->getPathInfo()!='/' and ($uri = $request->getRequestUri())!='/'){
2120
if(mb_substr($uri,0,mb_stripos($uri,'?')) != ''){
22-
$new_uri = mb_substr($uri,0,mb_stripos($uri,'?')-1).mb_substr($uri,mb_stripos($uri,'?'));
21+
$new_uri = mb_substr($request->getPathInfo(),0,-1).'?'.$request->getQueryString();
2322
}else{
2423
$new_uri = mb_substr($request->getPathInfo(),0,-1);
2524
}
2625
return redirect(env('APP_URL').$new_uri,301);
2726
}
28-
2927
return $next($request);
3028
}
3129
}

0 commit comments

Comments
 (0)