Typo3: Multi-Domain error when using a subdirectory as Typo3 root with mod_alias

Multi-Domain setup broke on Typo3 version 4.2.2 when I tried to use my Typo3 root folder as subdirectory with mod alias.

Typo3 was setup to serve multiple domains. For this example www.domain1.tld and www.domain2.tld. This worked fine Typo3 served the right root-page according to the domain-records.

At this time the Typo3 folder was the document root for my virtual host.

For some reasons I changed the document root in my virtual host configuration and wanted to access Typo3 via www.domain1.tld/cms/.

I created a new empty document root folder for my site and wanted to include the subdirectory cms via mod_alias in my virtual host config. So I could access my Typo3 via www.domain1.tld/cms/.

This worked fine except that www.domain2.tld/cms/ could not be reached. So the virtual host config broke my multi-domain setup.

Looking at the source code I noticed that the if statement that compared my domain-record against the actual requested domain never returned true because it did not compare www.domain1.tld against the given domain-record but www.domain1.tld/cms/.

So I changed the domain-record to www.domain1.tld/cms/ and it worked. again.

At this time i don’t know if this is a feature, bug or design flaw. If someone wanted to serve multiple Typo3 root-pages under the same domain this could be helpful but since it is called multi-domain setup I wonder if that should be the way it works.