How to migrate legacy PHP web applications to Laravel
Developing new features on old sites is a daunting task. Sooner or later they will have to be modernized, rewritten from scratch, or ultimately shut down.
An interesting approach to refactoring old codebases is in-place migration. You don’t rewrite the whole project from scratch, you just tweak it a little and make it work alongside its modern version.
Our project consisted of a sales flow, and content directories serving as landing pages, written with SEO goals in mind.
We installed Laravel on a new directory, called it sales, and initially it was completely blank. To use the same old assets (images, CSS, and the like) we decided to keep the public folder, well, public to both the legacy code and the Laravel framework.
To handle the migration, we added a rule in Apache’s .htaccess to send a part of request to the new Laravel directory, with the front index file called sales-index.php
RewriteRule ^search sales-index.php [QSA,L] RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^ index.php [QSA,L]
References
Related Posts
February 10, 2021
Quartz News Aggregator App
Everyday, we read loads of daily news around us. The importance of daily news and the information…
January 10, 2020
Page Speed Optimization
The most beautiful, well-designed, responsive, SEO perfect web page can be rendered meaningless by…
April 29, 2019
Legacy App Refactoring
We’d been working on this project for a few years, but never really had the time to work on…