We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 5282
    • 147 Posts
    Hi !
    I plan to add a subdomain to my website, and i’d like to use the same modx installation to manage both my existing and the new site i’m about to create.
    It seems the "subsites/subdomaines" plugin is the one i need :
    i think i understood how it works :
    _ i have to create a subdomain, for example sub.domaine.com, which links to domain.com ( where modx is located ), the plug-in will execute at each page loading and check if we "came from" the subdomain or not, if yes it redirects to the subdomain homapage.

    But, once you get to the subdomain homepage, the url in the browser adress bar is still the one of the subdomain ? ( = it is not a redirection ? ), and do the links generated by the snippets adapt to this new configuration ?, for example :
    i have a subfolder ( in the modx document tree ) entitled sub/, where is located a page called sub-page.html, this folder is accessible by the subdomain,
    will the links generated by the sub.html link to sub.domaine/subpage.html ??

    finally about the plug-in installation
    $e = &$modx->event;
    $subdomain = 'subdomain.yourdomain.com'; // your subdomain name here
    if($e->name=='OnWebPageInit') {
       $s = $_SERVER['HTTP_HOST'];
       if($s==$subdomain && $modx->documentIdentifier==$modx->config['site_start']){
          header('Location: index.php?id=6');
          exit;
       }
       else if($s==$subdomain){
           $modx->config['site_start'] = 6; // your start page here
           $modx->config['error_page'] = 6;	// your error page here
       }
    }

    i see 3 parameters to change ( in addition to the subdomain name ), the last two ones are the subdomain or main domaine pages ? and the 1st huh

    thanks ( sorry if my engligh isn’t much accurate )
      i’m not a native english speaker, sorry if there are any mistakes ! smiley

      Pikkitux.com Website about Ubuntu Linux, Website Creation, and many other how-tos, tips and tricks ... ( French Language, and of course Modx Powered ! )