how would you access the traditional app urls that aren't setup as routes?
Have a link to them.
Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.
I have a large php app that was not written in Laravel. I need to develop some new functionality and I'm curious if its possible to use Laravel and have it coexist with the rest of the application. Ideally over time the entire app would be rewritten, but that will take a while.
If this is possible, and the routes take over the url processing, how would you access the traditional app urls that aren't setup as routes?
I'm still new at this if you can't tell :) I tried searching before posting but I couldn't figure out the right terms. -Jon
I second the recommendation from @ohffs to watch the Paul Jones talk.
@jlrdw arch comments aren't doing you any favours.
It may be a stupid question, but with my understanding (or apparent lack thereof) if there is something controlling the routing urls won't that interfere with a url that is not listed in the routes?
For the sake of this (stupid) example, lets say there's 1 route only - /about , so /about hits Laravel as expected.
If in the HTML I link to /projectlist and that is not in the routes, will the project list still load?
It's not a stupid question.
With Laravel or any similar framework, all requests are routed through /index.php. This bootstraps the framework and the framework will then handle the routing. This is done using a rule in the /public/.htaccess Apache settings file:
# Handle Front Controller...
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [L]
With legacy apps, you might be using the file system directly for your routing. Is this what you're doing? So for example, you add a new page by creating a file like projectList.php. or projectList.html.
You can continue doing this while migrating to Laravel. Just put your legacy web pages in the /public folder. Note, however, that you must link to them with the file extension. So you will need to use <a href="/projectList.php"> (or .html, etc). Linking to /projectList will get "swallowed" by Laravel and result in a 404.
(This could be avoided by changing the .htaccess file, effectively defining legacy routes in there. Probably not much fun doing that).
So you can have some routes "inside" Laravel, and some "outside". The ones outside will need to use the file extension.
Alternatively, you can do a kind of "soft migrate" for your legacy pages. This is what I did. Inside your /resources/views folder, make a new folder called legacy-pages (or whatever). Now you need to make a catch-all route in Laravel:
// routes.php
// Some "proper" laravel routes here
Route::get('/about', 'PagesController@about');
// After everything else, your legacy pages
Route::get('{path?}', 'LegacyPagesController@show')->where('path', '.+');
This means that the LegacyPagesController will receive all undefined routes:
// LegacyPagesController
public function show($path)
{
$view = 'legacy-pages/' . $path;
if ( View::exists($view) )
{
return view($view) );
}
App::abort(404);
}
So if the page exists, it will be used. Otherwise you will get the 404 page.
Note this exact code may need some tweaking as I haven't tested it. The principle works, though; I am using this on my site for legacy content.
This was one of the things I got really stumped by when I was learning Laravel -- because of course, all the tutorials are about nice, sane, clean code, not digging yourself out a pit of legacy code despair. ;)
Please or to participate in this conversation.