31
gjShortUrlPlugin – Creating SEO landing pages and manage redirection of legacy URLs with the symfony and Doctrine plugin
No comments · Posted by Christian in The real job
At my work place at Gruner+Jahr I had to find a simple yet effective solution to the requirement of redirecting old legacy URLs to new and shiny symfony URLs after a relaunch.
Another requirement was to be able to build campaign and SEO landing pages that redirect to and article or search result or whatsit.
As a result of just a few hours of writing routing related code there is now a new kid in town: gjShortUrlPlugin.
The functionality of the plugin is very simple.
Every symfony route object implements a method called matchesUrl() which tries to match the URL pattern from the routing.yml on the current URL.
In gjShortUrlPlugin this method looks up a database table to do the matching. All methods to do the matching are atomic and easy to override.
The actual redirection is performed by a symfony module action controller which again gives you every opportunity to override.
Using the admin generator you can easily generate an admin tool to maintain your redirections.
In the README I have listed a few basic examples that should illustrate the flexibility of the plugin and gives you ideas on how to achieve your goals with it.
If anyone cares to write a Propel route I would be glad to add it to the plugin as an alternative option.
I hope this proves useful to someone out there.
gjShortUrlPlugin · Open Source · PHP · Plugin · plugins · symfony

