Source: juris-9772.medium.com

Serving Laravel from a subdirectory
I was browsing the issues on Laravel repo and came across one complaining about issues that arise from serving Laravel out of a subdirectory. Turns out there aremultiple such reports and the official answer is just that it’s not supported.

In fact there are no problems with serving it from a subdirectory as long as you take some care to set up the server and Laravel properly.

Don’t put Laravel in an actual subfolder, serve from example.com/subdirectory/public and expect Laravel to treat that as a base. You should instead redirect example.com/subdirectory to your Laravel app, provide Laravel with the full URI (including /subdirectory) and configure it to handle requests that start with that prefix.
Newsletter

Get the latest Laravel/PHP jobs, events and curated articles straight to your inbox, once a week

Fathom Analytics | Fast, simple and privacy-focused website analytics. Fathom Analytics | Fast, simple and privacy-focused website analytics.
Achieve superior email deliverability with ToastMail! Our AI-driven tool warms up inboxes, monitors reputation, and ensures emails reach their intended destination. Sign up today for a spam-free future. Achieve superior email deliverability with ToastMail! Our AI-driven tool warms up inboxes, monitors reputation, and ensures emails reach their intended destination. Sign up today for a spam-free future.
Community Partners