0
votes

Hi for my extensions I use RealUrl fixedPostVars for the detail view..

    'fixedPostVars' => array(
'article' => array(
    array(
        'GETvar' => 'tx_bla_news[action]',
        'valueMap' => array(
            'show' => '',
        ),
        'noMatch' => 'bypass'
    ),
    array(
        'GETvar' => 'tx_bla_news[controller]',
        'valueMap' => array(
            'Article' => '',
        ),
        'noMatch' => 'bypass'
    ),
    array(
        'GETvar' => 'tx_bla_news[article]',
        'lookUpTable' => array(
            'table' => 'tx_bla_domain_model_article',
            '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,
            'enable404forInvalidAlias' => 1,
        ),
    ),
),
'85' => 'article',

This generates a nice detail view URL like https://www.bla.com/article/title

Now when the article gets edited this URL does not work anymore on the first hit and we need go to list view to click it from there, before it works again.

I get this behavior on 2 different extensions. The above one is fairly simple.

How can I fix this. RealUrl 2.15

[EDIT 24 jan] ===============

Upon saving a record the corresponding entries for the record in tx_realurl_urldata and tx_realurl_uniqalias get deleted. How to prevent loosing the entries upon save??

The tx_realurl_uniqalias gets an expire timestamp.

If the action part gets changed in

    'valueMap' => array(
        'show' => 'show',
     ),
    'noMatch' => 'bypass'

Or just in

    'valueDefault' => 'show'

It works ok. But then I always get an extra URL part show..

======== Thanks to Franske I got it to work :)

Solution with ts:

    [globalVar = GP:tx_bla_news|article > 0]
        config.defaultGetVars {
        tx_bla_news {
            controller = Article
            action = show
        }
     }
    [global]
1
Are there any logics that change the identification of the original record? For example something that changes the UID or the original record gets deleted while a new one is created?Paul Beck
No the UID stays the same. It's a fairly simple extension.Jacco van der Post
What exacly does "URL does not work anymore"? What kind of error you get?Paul Beck
It just goes to the default action (list view) but remains the detail view URL bla.com/article/titleJacco van der Post
Not sure if it still works or exists but do you have plugin.tx_yourextension.mvc.callDefaultActionIfActionCantBeResolved = 1 enabled? If yes, deactive it to hopefully get an helpful error.Paul Beck

1 Answers

1
votes

Your problem is that the tx_realurl_urldata is deleted.

Once that happens realurl is not able to rebuild your url. When trying to decode /article/title it thinks that title is the action you want to call and that doesn't exists so you get a 404.

I would suggest to move the action and controller part to the end of the url. Or maybe even remove them and solve it like https://docs.typo3.org/typo3cms/extensions/news/AdministratorManual/BestPractice/Realurl/Index.html#removing-controller-and-action-arguments-from-url