TYPO3 RealUrl: select pagetree and language from url segment - typo3

We have multiple pagetrees for each region (e.g. Germany, Suisse). The pages themselves are translated to several languages (e.g. de, en) using the L-Parameter.
Now Realurl should match from 2 url segments to the approriate page tree and language. I know how this can be done with separate domains for each region using the _Domains feature. But in this case the domain stays always the same for all regions. Can this be achieved with Realurl and how?
http://example.com/de/de => should map to pagetree with rootpage_id 1 and language de (L=0)
http://example.com/de/en => should map to pagetree with rootpage_id 1 and language en (L=1)
http://example.com/ch/de => should map to pagetree with rootpage_id 2 and language de (L=0)
http://example.com/ch/en => should map to pagetree with rootpage_id 2 and language en (L=1)
real_url.conf
<?php
$GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['realurl']['_DEFAULT'] = array(
'init' => array(
'enableCHashCache' => 1,
'appendMissingSlash' => 'ifNotFile,redirect',
'adminJumpToBackend' => 1,
'enableUrlDecodeCache' => 1,
'enableUrlEncodeCache' => 1,
'emptyUrlReturnValue' => '/'
),
'pagePath' => array(
'type' => 'user',
'userFunc' => 'EXT:realurl/class.tx_realurl_advanced.php:&tx_realurl_advanced->main',
'spaceCharacter' => '-',
'languageGetVar' => 'L',
'expireDays' => '3',
'rootpage_id' => 1,
'firstHitPathCache'=>1
),
'preVars' => array(
array(
'GETvar' => 'L',
'valueMap' => array(
'de' => '0',
'en' => '1',
),
'valueDefault' => 'de',
),
array(
'GETvar' => 'no_cache',
'valueMap' => array(
'no_cache' => 1,
),
'noMatch' => 'bypass',
),
),
);

Now Realurl should match from 2 url segments to the approriate page tree and language.
RealURL cannot do that. Root page id is determined before segments are processed. It is defined by the domain record or your RealURL configuration.

Related

TYPO3 Multidomain Website Preview shows only Default Language

I'm using TYPO3 7.6 with a multidomain and multilanguage Website, you see the links below. I've one page tree and rootpage_id for all three languages!
First language is german (L=0, https://www.renosan.de/)
Second language is english (L=1, https://www.renosan.net/)
Third language is polish (L=2, https://www.renosan.pl/)
For every language I'm using an own top-level domain (de,net,pl). I've also insert the domain records at my root page (TYPO3-Backend List -> Rootpage -> Domain records)
If I'm clicking at the preview button (s. image), the preview opens in a new window with:
English: https://www.renosan.de/index.php?id=1&L=1
Polish: https://www.renosan.de/index.php?id=1&L=2
... but the content is still in the default language (german)! I need to change the TLD to change the Website language manually. It's not useful for my editors, because they aren't seeing the preview with one click.
Can someone explain the behaviour from TYPO3?
I also tried to login into Backend from .net or .pl, nothing happens. It's always the default preview. No special .htaccess entries ...
My TypoScript Setup
### default german
config {
linkVars = L(0-2)
uniqueLinkVars = 1
sys_language_mode = content_fallback
sys_language_overlay = hideNonTranslated
sys_language_uid = 0
language = de
locale_all = de_DE.UTF8
htmlTag_langKey = de
}
### english L=1
[globalString = IENV:HTTP_HOST = *renosan.net]
config {
baseURL = https://www.renosan.net/
sys_language_uid = 1
language = en
locale_all = en_GB.UTF8
htmlTag_langKey = en
}
[GLOBAL]
### polski L=2
[globalString = IENV:HTTP_HOST = *renosan.pl]
config {
baseURL = https://www.renosan.pl/
sys_language_uid = 2
language = pl
locale_all = pl_PL.UTF8
htmlTag_langKey = pl
}
[GLOBAL]
I have locate the problem with my individual realURL-conf. If I try it with the 'autoconf' from Ext:realURLthe preview from Backend works!
Here's my personal realURL-Configuration file:
<?php
$TYPO3_CONF_VARS['EXTCONF']['realurl']['_DEFAULT'] = array(
'pagePath' => array(
'type' => 'user',
'userFunc' => 'EXT:realurl/class.tx_realurl_advanced.php:&tx_realurl_advanced->main',
'spaceCharacter' => '-',
'languageGetVar' => 'L',
'expireDays' => '3',
'rootpage_id' => 1,
'firstHitPathCache'=> 1
),
'init' => array(
'enableCHashCache' => 1,
'respectSimulateStaticURLs' => 0,
'postVarSet_failureMode' => '',
'enableUrlDecodeCache' => 1,
'enableUrlEncodeCache' => 1
),
'preVars' => array(
array(
'GETvar' => 'L',
'valueMap' => array(
//'de' => '0',
'en' => '1',
'pl' => '2'
),
'noMatch' => 'bypass',
),
array(
'GETvar' => 'no_cache',
'valueMap' => array(
'nc' => 1,
),
'noMatch' => 'bypass',
),
),
'fixedPostVars' => array(
'newsDetailConfiguration' => array(
array(
'GETvar' => 'tx_news_pi1[action]',
'valueMap' => array(
'detail' => '',
),
'noMatch' => 'bypass',
),
array(
'GETvar' => 'tx_news_pi1[controller]',
'valueMap' => array(
'News' => '',
),
'noMatch' => 'bypass',
),
array(
'GETvar' => 'tx_news_pi1[news]',
'lookUpTable' => array(
'table' => 'tx_news_domain_model_news',
'id_field' => 'uid',
'alias_field' => 'title',
'addWhereClause' => ' AND NOT deleted',
'useUniqueCache' => 1,
'useUniqueCache_conf' => array(
'strtolower' => 1,
'spaceCharacter' => '-',
),
'languageGetVar' => 'L',
'languageExceptionUids' => '',
'languageField' => 'sys_language_uid',
'transOrigPointerField' => 'l10n_parent',
'autoUpdate' => 1,
'expireDays' => 180,
),
),
),
'42' => 'newsDetailConfiguration',
'43' => 'newsDetailConfiguration',
),
'postVarSets' => array(
'_DEFAULT' => array(
'controller' => array(
array(
'GETvar' => 'tx_news_pi1[action]',
'noMatch' => 'bypass',
),
array(
'GETvar' => 'tx_news_pi1[controller]',
'noMatch' => 'bypass',
),
),
'tags' => array(
array(
'GETvar' => 'tx_news_pi1[overwriteDemand][tags]',
'lookUpTable' => array (
'table' => 'tx_news_domain_model_tag',
'id_field' => 'uid',
'alias_field' => 'title',
'addWhereClause' => 'AND NOT deleted',
'useUniqueCache' => 1,
'useUniqueCache_conf' => array (
'strtolower' => 1,
'spaceCharacter' => '-',
),
),
),
),
'seite' => array(
array(
'GETvar' => 'tx_news_pi1[#widget_0][currentPage]',
),
),
// news archive parameters
'archiv' => array(
array(
'GETvar' => 'tx_news_pi1[overwriteDemand][year]',
),
array(
'GETvar' => 'tx_news_pi1[overwriteDemand][month]',
'valueMap' => array(
'january' => '01',
'february' => '02',
'march' => '03',
'april' => '04',
'may' => '05',
'june' => '06',
'july' => '07',
'august' => '08',
'september' => '09',
'october' => '10',
'november' => '11',
'december' => '12',
),
),
),
),
),
);
$TYPO3_CONF_VARS['EXTCONF']['realurl']['_DOMAINS'] = array(
'encode' => array(
array(
'GETvar' => 'L',
'value' => '0',
'useConfiguration' => 'renosan.de',
'urlPrepend' => 'https://www.renosan.de'
),
array(
'GETvar' => 'L',
'value' => '1',
'useConfiguration' => 'renosan.de',
'urlPrepend' => 'https://www.renosan.net'
),
[
'GETvar' => 'L',
'value' => '2',
'useConfiguration' => 'renosan.de',
'urlPrepend' => 'https://www.renosan.pl'
],
),
'decode' => array(
'renosan.de' => array(
'GETvars' => array(
'L' => '0',
),
'useConfiguration' => 'renosan.de'
),
'renosan.net' => array(
'GETvars' => array(
'L' => '1',
),
'useConfiguration' => 'renosan.de'
),
'renosan.pl' => array(
'GETvars' => array(
'L' => '2',
),
'useConfiguration' => 'renosan.de'
),
)
);
?>
Thanks for your help .. I have still no solution for this TYPO3-Problem?! Is it a TYPO3-Bug? Is there a problem with my realURL-Configuration-File?
I think your conditions are wrong and TYPO3 gets so confused that the conditions are ignored completely.
it is not
[global string = ENV: HTTP_HOST = ...
but:
[globalString = ENV:HTTP_HOST = ...
On the other hand I assume your TYPO3 will also gets confused about domains and additional language parameter. For preview you need to be logged in into the BE (cookies are domain dependend). So a preview in another language is possible only with language parameter. Your configuration mixes domains and language parameter: if you start with www.renosan.de?L=1 your baseurl is changed.
My recommandation: Split the handling depending on domain and L-Param.
If you use RealURL: Look at this blog post. Here you can see how to config realURL to watch at the Domains to seperate languages.
After that, you dont need conditions about the domains. You can use the simple [globalVar = GP:L = x] conditions.

Typo3: RealURL and Ext:news – News URLs are not rewritten

I'm runnning Typo3 6.2.4 with RealURL 1.12.8 and News (tx_news) 3.0.1. Using the automatic configuration from RealURL rewrites the URLs for "normal" pages, but not for news. The generated links look like this:
index.php?id=5&tx_news_pi1%5Bnews%5D=4&tx_news_pi1%5Bcontroller%5D=News&tx_news_pi1%5Baction%5D=detail&cHash=706379a0ef43d4020448c5193f865bf1
This is what automatic configuration gives me. I've just inserted the part from http://docs.typo3.org/typo3cms/extensions/news/Main/Administration/Realurl/Index.html. At the moment I'm not interested in creating a special kind of rewritten URL, I just want to get RealURL rewrite the news URLs. Once that's running, I think I'll get the rest figured out.
<?php
$GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['realurl']=array (
'_DEFAULT' =>
array (
'init' =>
array (
'enableCHashCache' => true,
'appendMissingSlash' => 'ifNotFile,redirect',
'adminJumpToBackend' => true,
'enableUrlDecodeCache' => true,
'enableUrlEncodeCache' => true,
'emptyUrlReturnValue' => '/',
),
'pagePath' =>
array (
'type' => 'user',
'userFunc' => 'EXT:realurl/class.tx_realurl_advanced.php:&tx_realurl_advanced->main',
'spaceCharacter' => '-',
'languageGetVar' => 'L',
'rootpage_id' => '1',
),
'fileName' =>
array (
'defaultToHTMLsuffixOnPrev' => 0,
'acceptHTMLsuffix' => 1,
'index' =>
array (
'print' =>
array (
'keyValues' =>
array (
'type' => 98,
),
),
),
),
'postVarSets' =>
array (
'_DEFAULT' =>
array (
// EXT:news start
'news' => array(
array(
'GETvar' => 'tx_news_pi1[action]',
),
array(
'GETvar' => 'tx_news_pi1[controller]',
),
array(
'GETvar' => 'tx_news_pi1[news]',
'lookUpTable' => array(
'table' => 'tx_news_domain_model_news',
'id_field' => 'uid',
'alias_field' => 'title',
'addWhereClause' => ' AND NOT deleted',
'useUniqueCache' => 1,
'useUniqueCache_conf' => array(
'strtolower' => 1,
'spaceCharacter' => '-',
),
'languageGetVar' => 'L',
'languageExceptionUids' => '',
'languageField' => 'sys_language_uid',
'transOrigPointerField' => 'l10n_parent',
'autoUpdate' => 1,
'expireDays' => 180,
),
),
),
// EXT:news end
),
),
),
);
It turned out that my realurl_conf.php was correct, but the TypoScript configuration part was missing. As soon as I put those lines in the template setup of my root page, Typo3 started to rewrite the URLs:
config.absRefPrefix = /
config.tx_realurl_enable = 1
config.uniqueLinkVars = 1
# dont forget to set the allowed range - otherwise anything else could be inserted
config.linkVars = L(0-3)
Source:
http://wiki.typo3.org/Realurl/manual#TypoScript_configuration
http://docs.typo3.org/typo3cms/extensions/realurl/Realurl/Configuration/HandlingRelativeLinksWithSpeakingUrls/Index.html

realUrl not writing preVar for default language

I am running realURL 1.12.6 on TYPO3 4.5.26
I am used to realURL creating paths that contain the preVar also for the default language, like www.example.com/de/seite/ and www.example.com/en/page/
In one case, this is just not happening - or I think, only sometimes.
In most of the cases, I get www.example.com/seite/ and www.example.com/en/page/
Where can this be changed?
PS: Here's the beginning of my realurlconf:
$TYPO3_CONF_VARS['EXTCONF']['realurl']['_DEFAULT'] = array(
'init' => array(
'enableCHashCache' => 1,
'appendMissingSlash' => 'ifNotFile',
'enableUrlDecodeCache' => 1,
'enableUrlEncodeCache' => 1,
'respectSimulateStaticURLs' => 0,
//'postVarSet_failureMode'=>'redirect_goodUpperDir',
),
'redirects_regex' => array (
),
'preVars' => array(
array(
'GETvar' => 'L',
'valueMap' => array(
'de' => '0',
'en' => '1',
),
'valueDefault' => 'de',
'noMatch' => 'bypass',
),
array(
'GETvar' => 'no_cache',
'valueMap' => array(
'no_cache' => 1,
),
'noMatch' => 'bypass',
),
),
If I use this configuration (valueDefault is set, noMatch not) then 404 error page is not triggered when calling urls like
www.domain.com/notexisting/someexistingpage/
or
www.domain.com/notexisting/
The 404 page is only triggered when calling urls like
www.domain.com/notexisting/alsonotexistingpage/
That means, realurl expects the first part of the url to be the language part (here: "notexisting") and if realurl can't map this key, it uses the "valueDefault". But I want the 404 to be triggered, how can I achieve this?
Edit: I've the solution now:
realurl config:
'GETvar' => 'L',
'valueMap' => array(
'en' => '0',
'de' => '1',
),
'noMatch' => 'bypass',
TypoScript config:
config.defaultGetVars.L = 0
config.linkVars = L
Remove 'noMatch' => 'bypass', from your preVar configuration. The GET-Parameter "L" is not set to "0" if you open "www.example.com", so then the noMatch just bypasses the preVar configuration. If you only set valueDefault, it should work fine.

Typo3 realurl wrong defaultValue in links after clearCache

I´m running a Typo3 4.5.12 and the realurl extension verson 1.11.1.
My site has 3 languages de, en, ch and the default language is de, german.
If I clear the cache of realurl and call first www.example.com/site all is ok.
But if I call after clearCache first for example a url with language-param like www.example.com/en/site and after that www.example.com/site, all links get the ../en/.. in the href-tag like www.example.com/en/site2.
It´s the same when I call first after clearCache a site with ../ch/.. or ../de/..
Why he don´t pick the default-language when I call www.example.com/site in links?
My config of realurl:
$TYPO3_CONF_VARS['EXTCONF']['realurl']['_DEFAULT'] = array(
init' => array(
'enableCHashCache' => 1,
'appendMissingSlash' => 'ifNotFile',
'enableUrlDecodeCache' => 1,
'enableUrlEncodeCache' => 1,
'respectSimulateStaticURLs' => 0,
),
'redirects_regex' => array (
),
'preVars' => array(
array(
'GETvar' => 'no_cache',
'valueMap' => array('no_cache' => 1),
'noMatch' => 'bypass',
),
array(
'GETvar' => 'L',
'valueMap' => array(
'de' => '0',
'en' => '1',
'cn' => '2',
),
'defaultValue' => 'de',
'noMatch' => 'bypass',
),
),
...
My page config:
simulateStaticDocuments = 0
tx_realurl_enable = 1
prefixLocalAnchors = all
linkVars = mobile(off),L
uniqueLinkVars = 1
sys_language_uid = 0
language = de
locale_all = de_DE.UTF-8
sys_language_mode = content_fallback
sys_language_overlay = 1
[...]
'defaultValue' => 'de',
'noMatch' => 'bypass',
[...]
Are somewhat contra dictionary.
Take the noMatch out, this will create url's like:
/site1 (german)
/en/site1 (english)
/cn/site1 (chinese)
Otherwise go for
'noMatch' => 'de' //(without `'defaultValue' => 'de'`)
to get
/de/site1 (german)
/en/site1 (english)
/cn/site1 (chinese)

realurl in typo3

I'm working on a website that is made in typo3. I'm doing a part of the website that is made by somebody else, so I don't know that much of typo3.
This website uses realurl to translate the url to a readable one. How can I make a realurl? When I make like for example the index page there is no realurl made for this page. How could I generate one?
First of all, check the manual of realurl :
http://typo3.org/extensions/repository/view/realurl/current/
http://typo3.org/documentation/document-library/extension-manuals/realurl/1.10.2/view/
Check if RealUrl is enabled via TypoScript.
Check if links are generated with TYPO3 API / TypoScript.
Use RealUrl configurators
http://typo3.org/extensions/repository/view/cbrealurl/current/
Dmitry got more relevant tutorials about RealURL:
http://www.dmitry-dulepov.com/2008/05/realurl-made-easy-part-1.html
http://www.dmitry-dulepov.com/2008/06/realurl-made-easy-part-2.html
RealURL will be very easy to understand when you'll make it work with default configuration and understand the meaning of parts: 'init', 'preVars', 'postVarSets', 'pagePath', 'fixedPostVars' and 'fileName'.
Copy my configuration
typoscript in setup:
config.simulateStaticDocuments = 0
config.baseURL = /
config.tx_realurl_enable = 1
config.uniqueLinkVars = 1
config.absRefPrefix = http://www.ceisufro.cl/
page.config.language = cl
config.sys_language_uid= 0
config.useSysLanguageTitle = 1
config.language= es
config.language_alt= es
config.htmlTag_langKey= es
config.linkVars = L
config.sys_language_overlay = 1
config.htmlTag_setParams = xmlns="http://www.w3.org/1999/xhtml"
xml:lang="es" lang="es"*
In file localconf.php
$TYPO3_CONF_VARS['EXTCONF']['realurl'] = array(
'www.ceisufro.cl'=> array(
'init' => array (
'enableCHashCache' => '1',
'appendMissingSlash' => 'ifNotFile',
'enableUrlDecodeCache' => '1',
'enableUrlEncodeCache' => '1',
),
'redirects' => array (
),
'preVars' => array(
'0' => array(
'GETvar' => 'L',
'valueMap' => array(
'es' => '1',
'en' => '0',
'it' => '4',
),
'noMatch' => 'bypass',
'valueDefault' => 'es',
),
),
'fileName' => array(
'defaultToHTMLsuffixOnPrev' => '1',
),
'pagePath' => array(
'type' => 'user',
'userFunc' => 'EXT:realurl/class.tx_realurl_advanced.php:&tx_realurl_advanced->main',
'spaceCharacter' => '-',
'languageGetVar' => 'L',
'expireDays' => '3',
'rootpage_id' => '1',
), 'fileName' => array (
'index' => array (
'rss.xml' => array (
'keyValues' => array (
'type' => '100',
'id' => '37'
),
),
'contacto.xml' => array (
'keyValues' => array (
'id' => '666',
'no_cache'=>'1'
),
),
)),
'fixedPostVars' => array(
),
),
);
go to ext manager, find the ext realurl and add the following configurations
check Enable automatic configuration
select Serializable in Automatic configuration file format
check Enable devLog
I wait to can help somebody