redirect 'home' to a child page?

Permalink
Hi,

I have read various posts about doing this but none seem quite right.

I have 3 mini sites under one domain. I need 'home' to automatially redirect to the first child folder 'section one'

so when someone visitshttp://www.mydomain.com they will be automatically taken towww.www.mydomain.com/section-one...

I have tried using 'replace first in nav attribute' but that doesnt work for what i need.

Do i do a redirect in htacess file, or is there a concrete5 way of doing this?

many thanks in advance

pixelfish
 
ScottC replied on at Permalink Best Answer Reply
ScottC
I assume you have 3 mini sites that are all under 1 concrete5 instance? 3 mini concrete5 sites as in they all have their own db, files etc and nothing shared is a different approach. assuming that you are trying to intercept a requrest to the homepage and want to display a different page.

concrete5 way i think is to actually check out around line 140 in dispatcher.php

if (C5_ENVIRONMENT_ONLY == false) {
      // figure out where we need to go
      $req = Request::get();
      if ($req->getRequestCollectionPath() != '') {
         if (ENABLE_LEGACY_CONTROLLER_URLS) {
            $c = Page::getByPath($req->getRequestCollectionPath(), false);      
         } else {
            $c = $req->getRequestedPage();
         }
      } else {
         $c = Page::getByID($req->getRequestCollectionID(), false);
      }
      if ($c->isError()) {
         // if we've gotten an error getting information about this particular collection
         // than we load up the Content class, and get prepared to fire away


You could introduce a check of simply
if($c->getCollectionID() == HOME_CID){
$c = Page::getByPath('/section-one');
}
//right before
if ($c->isError()) {


worth it? probably not.

None of that is tested.
pixelfish replied on at Permalink Reply
pixelfish
this works a treat thanks!
pixelfish replied on at Permalink Reply
pixelfish
the 3 mini sites are not sperate db etc. they are just 3 sites under the home folder of one isntall.

So basically i want the home link to default the user to the first of the 3 sites.

this method works but will the search engine still thinkhttp://www.mysite.com is seperate tohttp://www.mysite.com/section1?

do i use htaccess redirect to achieve this?