简体   繁体   中英

Multiple Subdomain redirect to TYPO3 and RealUrl

I have TYPO3 7.6.18 installed with realURL and two languages (en,fr) on a single tree. the installation is on subdomain fr.mysite.com with bot domains added to the root page. For both languages I need a different subdomain. On first call of en.mysite.com I need to redirect to fr.mysite.com but the URL keeps at fr.mysite.com. Clicking on a link then changes the URL correctly to en.mysite.com.

I'm aware that the following htaccess is wrong but I got no idea how it should be.

htaccess

RewriteCond %{HTTP_HOST} ^en.mysite.com$ [NC]
RewriteRule ^ http://fr.mysite.com/%{REQUEST_URI} [P]

Adding ?L=1 to the RewriteRule solves the problem on a first call and the URL ist correctly en.mysite.com but then on a second call like en.mysite.com/subsite realURL shows the postVar error.

the typoscript:

config {
    sys_language_uid = 0
    simulateStaticDocuments = 0
    language = de
    baseURL = http://fr.mysite.com/
}


[globalVar = GP:L = 1]||[globalVar = GP:L = en] || [globalString = 
IENV:HTTP_HOST = en.mysite.com]
config {
        sys_language_uid = 1
        language = en
        baseURL = http://en.mysite.com/
}
[global]

realurl_conf:

...
'preVars' =>
    array (
        0 => array(
            'GETvar' => 'L',
            'valueMap' => array(
                'en' => '1'
            ),
            'noMatch' => 'bypass'
        )
    ),
...

Any help would be highly appreciated.

I don't think that changes in the default .htaccess are required but both domains are handled by TYPO3 and realurl.
In realurl you've to make a setup for both domains and adjust the required parameters on base of a default configuration.
In Backend you've to create the required language-records beside the setup which you posted.
Your Setup has a fault, for fr it should be like this:

config {
  sys_language_uid = 0
  simulateStaticDocuments = 0
  language = fr
  baseURL = http://fr.mysite.com/
}

EDIT: Above I assume that both domains are handled by the same TYPO3 installation. That's possible and in general a good solution.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM