Hi everyone,
I'm migrating an old plain php website to Laravel, everything works fine except one small thing.
Evey time I port an old website to Laravel I'm facing the same problem : keeping the old urls working cause the customer already shared on the net, social and so on, and rightly he doesn't want to loose the seo work he has done.
Right now I've created an array of old urls -> new urls and create the routes with redirects in a simpel foreach loop.
Is there a "best practice" to handle this situation?
Changing the .htaccess? (even if I prefer the customer to be able to edit the redirects array)
Some kind of library?
I actually ended up creating a controller that manages an old-route -> new-route relationship and generates the routes with the full path.
It was actually quite an easy job cause I used the old sitemap to parse old routes and the new ones have similar names,
how do you have two htaccess files in the same folder?
if you don't, because actually one is in the main laravel folder then you have a serious vulnerability in your setup.. one that could allow someone list the contents of your .env file
I have a parent .htaccess redirect to the "public" folder that Laravel creates.
Then, I have a .htaccess within that "public" folder to handle the redirects.
This worked slick without any htaccess hacks. This is what I did to handle GET parameters that I needed to change around Route::redirect('quotes.php', 'quote/'.request()['quote-id'] ?? ''.'/'.request()['c'] ?? '');