PHP middleware to remove a path prefix from a request uri
Latest commit 763f854 Dec 26, 2016 @Lansoweb committed on GitHub Merge pull request #4 from alexandrecintra/patch-1
remove UrlHelper section

Base Path Middleware for PHP

This middleware just removes a prefix from the request uri.


This middleware can be installed with composer.

$ composer require los/basepath


Just add the middleware as one of the first in your application.

For example:

$app->pipe(new \LosMiddleware\BasePath\BasePath('/site'));

Every request with /site prefix will be replaced:

/site => /
/site/blog => /blog
/site/contact-us => /contact-us

Zend Expressive

If you are using expressive-skeleton, you can copy config/ to config/autoload/ and modify configuration as your needs.