stitcher-core
stitcher-core copied to clipboard
Rewrite rules and headers
At this moment, Stitcher heavily relies on .htaccess to handle URL rewrites and setting custom headers, for eg. HTTP/2 server push support.
It's well known that .htaccess has a performance cost, and is better avoided. Furthermore by relying on .htaccess, Stitcher won't work out of the box on nginx servers.
It would be better to let Stitcher handle routing itself. This means a PHP script has to run on every request, but it offers a lot more flexibility:
- Handle routing and headers without being dependent on the underlying webserver.
- It's much more easy to add dynamic extensions to a static website.
So the question is: which router to use, and how to handle the mapping of headers for each route (they should still be generated during compiletime, not runtime).
- https://github.com/nikic/FastRoute
- https://github.com/thephpleague/route