Custom Router problem

Stepel

Member
Hi,

I've created my own router based on XenForo_Route_Interface.
In 'match' method I analyse $request->getRequestUri() and after finding some patterns I return $newRoutePath. (I am trying to translate old links (from old forum based on vB) to XF links)

Morover I extended XenForo_Router. In 'match' method I added Rule to $this->_rules array.
Generaly it works as I want... but i have two problems:

1. my forum works on https, but when i try to open URL which has been catched by my custom router on the server there is redirected first to the http and then to https :/

2. example when i have url like 'https://myforum.com/somepage.php?t=3' and my custom router translated that "somepage.php?t=3" i get: https://myforum.com/MY_XF_PROPERLY_LINK/?t=3

Why there is ?t=3 on the end of the link ?

Any suggestions?
 
Last edited:
Thanks for answer.
My code works the same like XenForo_Route_Filter.
The most important method there is "match".

this is my method:
PHP:
public function match($routePath, Zend_Controller_Request_Http $request, XenForo_Router $router)
    {
      
                $routePath = $request->getRequestUri();
                $newRoutePath = self::replaceLink($routePath); //my Own Function
              
                if ($newRoutePath != $routePath && $newRoutePath != '')
                {
                    $match = $router->getRouteMatch();
                    $match->setModifiedRoutePath($newRoutePath);
                    return $match;
                }

            return false;
    }

Actually the problem with parameter is not so important.
I am afraid that there is BUG with this https->http->https redirect.
If you have https protocol on your forum you can check it on the server.
If you use Route Filter it happens too. Even I comment my additional code.
 
Last edited:
Back
Top Bottom