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

Custom Router problem

Discussion in 'XenForo Development Discussions' started by Stepel, Jun 24, 2015.

  1. Stepel

    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: Jun 24, 2015
  2. Daniel Hood

    Daniel Hood Well-Known Member

    Hello,

    It's rather difficult to debug without seeing some code.
     
  3. Stepel

    Stepel Member

    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($routePathZend_Controller_Request_Http $requestXenForo_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: Jun 25, 2015

Share This Page