17488 Posts in 4473 Topics by 1978 members
|
Page:
1
|
Go to End | |
| Author | Topic: | 2155 Views |
-
URI

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?
-
Re: URI

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.
-
Re: URI

27 January 2008 at 6:43pm
I believe he meant he is subscribing to the topic so he can track the updates.
-
Re: URI

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();
}
| 2155 Views | ||
|
Page:
1
|
Go to Top |





