Reputation: 1616
I'm simply using the official realurl conf on the tx_news documentation. That caused a duplicate slash in my url. It would look like that:
domain.com/post//post-title
To fix it, I found out that I either have to remove or place the following lines after the tx_newspil[news] inside the fixedPostVars:
Before:
'fixedPostVars' => [
'newsDetailConfiguration' => [
[
'GETvar' => 'tx_news_pi1[action]',
'valueMap' => [
'' => 'detail',
],
'noMatch' => 'bypass'
],
[
'GETvar' => 'tx_news_pi1[controller]',
'valueMap' => [
'' => 'detail',
],
'noMatch' => 'bypass'
],
[
'GETvar' => 'tx_news_pi1[news]',
'lookUpTable' => [
'table' => 'tx_news_domain_model_news',
'id_field' => 'uid',
'alias_field' => 'IF(path_segment!="",path_segment,title)',
'addWhereClause' => ' AND NOT deleted',
'useUniqueCache' => 1,
'languageGetVar' => 'L',
'languageExceptionUids' => '',
'languageField' => 'sys_language_uid',
'transOrigPointerField' => 'l10n_parent',
'expireDays' => 180,
'enable404forInvalidAlias' => true
]
]
]
]
After:
'fixedPostVars' => [
'newsDetailConfiguration' => [
[
'GETvar' => 'tx_news_pi1[news]',
'lookUpTable' => [
'table' => 'tx_news_domain_model_news',
'id_field' => 'uid',
'alias_field' => 'IF(path_segment!="",path_segment,title)',
'addWhereClause' => ' AND NOT deleted',
'useUniqueCache' => 1,
'languageGetVar' => 'L',
'languageExceptionUids' => '',
'languageField' => 'sys_language_uid',
'transOrigPointerField' => 'l10n_parent',
'expireDays' => 180,
'enable404forInvalidAlias' => true
]
],
[
'GETvar' => 'tx_news_pi1[action]',
'valueMap' => [
'' => 'detail',
],
'noMatch' => 'bypass'
],
[
'GETvar' => 'tx_news_pi1[controller]',
'valueMap' => [
'' => 'detail',
],
'noMatch' => 'bypass'
]
]
]
Either switching them or simply deleting the controller / action parts fixed the duplicate slash. Now I'd like to understand why that is so, since im a PHP beginner I don't really get it.
I appreciate all the help!
** Just tested, only the action part had to be moved or deleted in order to resolve the duplicate slash
Upvotes: 1
Views: 643
Reputation: 4526
This happens because the REALURL
configuration gets parameters in the order you add.
Let's take the first REALURL
configuration from your post. Within this configuration I expect my URL be so: /page/action/controller/post-title
.
What happens there is that you have the news plugin with action
and controller
params set in the post page and then you don't pass the action
and controller
in the URL
, that's why you have double slashes
there, because action
and controller
are empty.
Default parameters (e.q controller name, action name, etc), parameters where the value is not required, must be at the end of the configuration, like your last configuration.
Upvotes: 2