[TYPO3-english] Real URL and subdomains

Xavier Perseguers typo3 at perseguers.ch
Sat Apr 4 07:09:09 CEST 2009


Hi,

> I have a system that creates sites on fly. Every new site is assigned a 
> new sub-domain. For example a.mydomain.com, b.mydomain.com, .. and so on.
> I need all these *.mydomain.com sites to share the same realurl 
> configuration.
> 
> My typo3 installation though has other domain too as for instance 
> mynewdomain.org.
> 
> I see that realurl ext wants me to create one array for www.mydomain.com 
>  domain and then add aliases to the 
> $TYPO3_CONF_VARS['EXTCONF']['realurl'] like
> 'a.mydomain.com' => 'www.mydomain.com',
> 'b.mydomain.com' => 'www.mydomain.com',
> ...
> 'N.mydomain.com' => 'www.mydomain.com',
> 
> the problem with this is that the sites and hence the subdomain names 
> are created on fly.
> 
> i tried and can see that array like *.mydomain.com is not inderstood by 
> realurl.
> 
> Does realurl have solutino for this.
> If not pelase let me know what solution you think I should make so that 
> it later is added to the realurl codebase.

I did this in a similar configuration (I had to handle different default 
language too):

file realurl_conf.php:

<?php
require_once('realurl_project.php');

$TYPO3_CONF_VARS['FE']['addRootLineFields'] .= 
',tx_realurl_pathsegment,alias,nav_title,title';

$TYPO3_CONF_VARS['EXTCONF']['realurl']['_DEFAULT'] = array(
         // snip
);

$config = $configHosts[$_SERVER['HTTP_HOST']];
if ($config) {

                 // Set rootpage id
 
$TYPO3_CONF_VARS['EXTCONF']['realurl']['_DEFAULT']['pagePath']['rootpage_id'] 
= $config['uid'];

// further config with default language


}

?>


file realurl_project.php (automatically generated):

<?php
$configHosts = array(
         'a.mydomain.com' => array(
                 'uid' => 4,
                 'defaultLanguage' => 'fr',
         ),
         'b.mydomain.com' => array(
                 'uid' => 120,
                 'defaultLanguage' => 'en',
         ),
);
?>


I guess you now have an idea of what may be done if you include other 
files in realurl_conf.php.

-- 
Xavier Perseguers
http://xavier.perseguers.ch/en

One contribution a day keeps the fork away


More information about the TYPO3-english mailing list