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.

Archive /

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

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

URI


Reply


7 Posts   2307 Views

Avatar
KatB

Community Member, 94 Posts

25 January 2008 at 4:29pm

I have a pre-existing URI site structure that I would prefer to keep. It would be so much easier to keep it.

The alternative is to create a new line in my .htaccess for each page that I am replacing. That will end with a huge .htaccess file, and surely, a performance hit.

What would the Silverstripe team recommend?

Avatar
Tim

Core Development Team, 201 Posts

25 January 2008 at 5:39pm

There is away of remapping legacy URL's... I'll get one of the devs to post some info on this.

Avatar
Fuzz10

Community Member, 787 Posts

25 January 2008 at 11:38pm

subscribe

Avatar
KatB

Community Member, 94 Posts

27 January 2008 at 6:17pm

to what?

Avatar
Liam

Community Member, 470 Posts

27 January 2008 at 6:43pm

I believe he meant he is subscribing to the topic so he can track the updates.

Avatar
Fuzz10

Community Member, 787 Posts

27 January 2008 at 11:52pm

Yeah, sorry... My bad... should've been more clear..

Avatar
Andy

230 Posts

30 January 2008 at 8:59am

There is a 'redirector' page type that you can use to redirect pages, unfortunately this doesn't support multi level URLs (like news/article-one). The other method that I've used to solve this in the past is to check for the second level URL in the init function like this:

   function init() {
      if($this->urlParams['Action']) {
         $oldurl = Convert::raw2sql($this->urlParams['Action']);
         $page = DataObject::get_one('SiteTree', "REPLACE(URLSegment, '-', '')='$oldurl'");
         if($page) {
            Director::redirect($page->Link());
            Page_Controller::init();
            return;
         }
      }
      
      parent::init();
   }