nchristiansen's avatar

Advanced Routing

I am re-building some features from a legacy website built in PERL into Laravel 5.2.

Eventually we will migrate entirely to Laravel, but in the meantime I need to figure out how to integrate Laravel into our new site.

Though symlinks and Apache rewrite rules I have managed to get Laravel responding to requests.

What I need though is to get Laravel to build the route based on the PATH_INFO instead of the REQUEST_URI.

                [REQUEST_URI] => /1234/us-en/l/dummy
                [SCRIPT_NAME] => /l/public/index.php
                [PATH_INFO] => /1234/us-en/dummy
0 likes
3 replies
nchristiansen's avatar
nchristiansen
OP
Best Answer
Level 2

Thank you @vvvphpdev. You got me in the right frame of mind to get the right file.

My solution is to add to the Symfony\Component\HttpFoundation\Request prepareRequestUri() function the following code:

            $this->server->remove('ORIG_PATH_INFO');
        }

        if ($requestUri !== $this->server->get('PATH_INFO')) {
            $requestUri = '/' . $this->server->get('PATH_INFO');
        }

        // normalize the request URI to ease creating sub-requests from this request
        $this->server->set('REQUEST_URI', $requestUri);

However I would like to update it so that can be an optional case.

vvvphpdev's avatar

Lol, you must check my answer instead of yours @nchristiansen

I told you, you could extends those classes and replace it inside your config/app.php under key providers, are you familiar with class wrapping design?

Please or to participate in this conversation.