Realurl config for not existing slug (alias)

If you forget to configure realurl extension for records aliases well then if you will try to enter some fake record slug the this slug will be not mapped to uid by realurl and will be passed as string to extbase which will try to map this string to uid of record which ends up with php fatal error.

To avoid that you can put enable404forInvalidAlias setting in lookUpTable configuration. In such case when slug is not found TYPO3 will show standard 404 support defined in TYPO3.

Example of lookUpTable config without:

'GETvar' => 'tx_recipe_recipe[recipe]',
                'lookUpTable' => [
                    'table' => 'tx_recipe_domain_model_recipe',
                    'id_field' => 'uid',
                    'alias_field' => 'name',
                    'addWhereClause' => ' AND NOT deleted',
                    'languageGetVar' => 'L',
                    'languageField' => 'sys_language_uid',
                    'transOrigPointerField' => 'l10n_parent',
                    'useUniqueCache' => 1,
                    'useUniqueCache_conf' => [
                        'strtolower' => 1,
                        'spaceCharacter' => '-',
                    ],
                    'autoUpdate' => 1,
                    'expireDays' => 10,
                ],

Example with

'GETvar' => 'tx_recipe_recipe[recipe]',
                'lookUpTable' => [
                    'table' => 'tx_recipe_domain_model_recipe',
                    'id_field' => 'uid',
                    'alias_field' => 'name',
                    'addWhereClause' => ' AND NOT deleted',
                    'languageGetVar' => 'L',
                    'languageField' => 'sys_language_uid',
                    'transOrigPointerField' => 'l10n_parent',
                    'useUniqueCache' => 1,
                    'useUniqueCache_conf' => [
                        'strtolower' => 1,
                        'spaceCharacter' => '-',
                    ],
                    'enable404forInvalidAlias' => 1,
                    'autoUpdate' => 1,
                    'expireDays' => 10,
                ],

 

Leave a Comment.