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   2297 Views

Avatar
KatB

25 January 2008 at 4:29pm Community Member, 94 Posts

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

25 January 2008 at 5:39pm Core Development Team, 201 Posts

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

Avatar
Fuzz10

25 January 2008 at 11:38pm Community Member, 787 Posts

subscribe

Avatar
KatB

27 January 2008 at 6:17pm Community Member, 94 Posts

to what?

Avatar
Liam

27 January 2008 at 6:43pm Community Member, 470 Posts

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

Avatar
Fuzz10

27 January 2008 at 11:52pm Community Member, 787 Posts

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

Avatar
Andy

30 January 2008 at 8:59am 230 Posts

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();
   }