Reroute Plugin for Craft
Trevor Davis, Former Front-End Development Technical Director
Article Category:
Posted on
You know what's really annoying? Having a million redirects in your .htaccess file. When we build EE sites, Detour Pro has become a part of our builds so that other team members and clients can manage redirects. But, that solution won't really work when you launch your first Craft site for a client!
Introducing Reroute for Craft
I had previously built a couple of small Craft plugins, but none with control panel sections and database tables. So I decided to dig in and give it a shot.
What came out was a lovely simple interface for adding redirects. Here is the page that lists your redirects:
And here is the simple form to add a new Reroute:
I've gotta say the Craft Documentation and Cocktail Recipes sample plugin were extremely helpful in building it. There were still times where I couldn't find what I needed, but luckily Pixel & Tonic was always there to help!
@trevor_davis Your plugin’s init() function happens very early on in each request ;)
— Craft (@craftcms) December 9, 2013
@trevor_davis It should! Try throwing die(‘hello?’) in there.
— Craft (@craftcms) December 9, 2013
@trevor_davis You could use craft()->request->redirect(‘url’);
— Craft (@craftcms) December 9, 2013
You can download the plugin on GitHub. Enjoy!