Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

We're retiring the forums!

The SilverStripe forums have passed their heyday. They'll stick around, but will be read only. We'd encourage you to get involved in the community via the following channels instead:

Migrating a Site to Silverstripe /

What you need to know when migrating your existing site to SilverStripe.

Moderators: martimiz, Sean, Ed, biapar, Willr, Ingo, swaiba

LegacyURL recipe from SS handbook doesn't do anything

Go to End

3 Posts   3943 Views


Community Member, 3 Posts

8 September 2009 at 10:51am

I need the LegacyURL function for the site I am building. I took the code from the CD that came with the German SilverStripe handbook. But the code does not seem to have any effect. Here is what I found out so far:
1. There seems to be a LegacyURL field in the datastructure, even before I added the code.
2. After I added the code into page.php, _config.php and had set up CustomModelAsController.php, the field "Old URL" appears in the Backend after I did /db/build/?flush=1
3. When I enter e.g. "testtest.html" as LegacyURL in the Backend, and then call up that html file, if that file exist, it is displayed, if the file does not exist, the usual "Page not found" error message comes, but no redirection is done in eighther case.
4. The recipe says in mysite/code/page.php: $fields->addFieldsToTab('Root.Content.Main', new TextField('LegacyURL', 'Alte URL'));
but another line in my page.php is $fields->addFieldToTab("Root.Content.Widgets", new WidgetAreaEditor("Sidebar"));
Now is "addFieldToTab" correct or "addFieldsToTab" ?
(Note: I use SS 2.3.2 on a typical Suse LAMP System, my SS Installation runs in a subfolder: www.mydomain.tld/CMS/ not in the root folder does that affect the LegacyURL?)

Is there anybody who can help? Does the LegacyURL recipe work for anyone?


Forum Moderator, 801 Posts

13 September 2009 at 6:14pm

There's some discussion about the limitations of this recipe here (in German):

Perhaps start with a new SilverStripe project, and do the recipe step-by-step alongside the instructions to avoid code duplications etc.

> The recipe says in mysite/code/page.php: $fields->addFieldsToTab('Root.Content.Main', new TextField('LegacyURL', 'Alte URL'));
It should be addFieldToTab() (singular), that was actually a typo in the book... - I've added it to the "Errata" page on


Community Member, 2 Posts

23 January 2013 at 10:13am

Edited: 23/01/2013 10:15am


Just figured out that the CustomModelAsController class from the book uses HTTPResponse instead of correct SS_HTTPResponse. Just modify this line and your redirects will work properly:

$response = new SS_HTTPResponse();