• This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.

Design issue Redirect error with page

Mike

XenForo developer
Staff member
#4
This is more or less a design issue with the redirects. We can't remove query string params when redirecting as they generally won't be handled by the route itself. Here's a situation where the param can theoretically be seen both as part of the route itself and the query string.

In general, this URL should never be generated. If it is, that would be a bug, but I don't think it's possible with our URL generation options.
 

caoanh204

Active member
#5
This is more or less a design issue with the redirects. We can't remove query string params when redirecting as they generally won't be handled by the route itself. Here's a situation where the param can theoretically be seen both as part of the route itself and the query string.

In general, this URL should never be generated. If it is, that would be a bug, but I don't think it's possible with our URL generation options.
Yes, I got it when redirect old url when convert from vBulletin.
I must to add this code to index.php to fix it.

PHP:
if(preg_match('#^/threads/(?<slug>[a-z0-9\-]+)\.(?P<id>[0-9]+)/page-(?P<page>[0-9]+)\?page\=(?P<page2>[0-9]+)$#i',$_SERVER['REQUEST_URI'],$arr))
{
    header("Location: /threads/{$arr['slug']}.{$arr['id']}/page-{$arr['page']}",1,301);
    exit;
}