Jump to:

17452 Posts in 4473 Topics by 1971 members


SilverStripe Forums » Archive » permanent redirections

Our old forums are still available as a read-only archive.

Moderators: martimiz, Sean, biapar, Willr, Ingo, simon_w

Page: 1
Go to End
Author Topic: 1455 Views
  • Nicolaas
    Forum Moderator
    213 Posts

    permanent redirections Link to this post

    Hi Folk

    I am rebuilding a site from straight html to a silverstripe application. I would like to setup automatic redirects for the old pages. In the database, I noticed the legacyUrl field. How can I use that? There are 137 pages so a "global" solution would be best.

    Any help much appreciated.



  • Sam
    679 Posts

    Re: permanent redirections Link to this post

    I think that the LegacyURL field is something for a specific site that accidentally got put into the main codebase! :-P

    Are the old URLs in any consistent format? Your two basic solutions are setting up RedirectorPage pages with the old URLs, if the are of the form http://www.mysite.com/(url)/

    If they are mostly in a couple of directories, you could set up director rules that point to a custom controller that does the redirection.

    For example, if you have a bunch URLs of the form http://www.mysite.com/products/(XXX).html,

    you could set up a director rule

    'products/$ProductURL' => 'ProductRedirector'

    and then make a class

    class ProductRedirector extends Controller {
    function index() {
    // do something with $this->urlParams['ProductURL'];

  • Nicolaas
    Forum Moderator
    213 Posts

    Re: permanent redirections Link to this post

    Hi Sam

    thank you for your reply. you should keep the legacyUrl, it is USEFUL!

    Anyway, this is how I did it (dirtiest hack of the month):


Page: 1
Go to Top

Want to know more about the company that brought you SilverStripe? Then check out SilverStripe.com

Comments on this website? Please give feedback.