0
votes

I am pretty new to typo3. The Website is all set up now i want to use realurl to make some human readable URLS.

Out of the boy it works pretty well. But not for my news sites.

http://myDomain/news-events/news/Name-of-the-Article/?tx_news_pi1%5Bday%5D=19&tx_news_pi1%5Bmonth%5D=7&tx_news_pi1%5Byear%5D=2017&cHash=6af067caeb037b4de744f6b9e07b73e8

Please help me to get rid of the last Parameters. to get something like:

http://myDomain/news-events/news/Name-of-the-Article/

Here is my realurl_conf

[ See Update]

Thank you all for your time =)

Update:

So i worked my way through the manual. I copied from them and inserted my IDs and Stuff this is my new Configuration [ Deleted the first one ]

<?php

$GLOBALS['TYPO3_CONF_VARS']['FE']['addRootLineFields'] .= ',tx_realurl_pathsegment';

// Adjust to your needs
$domain = 'http://mydomain.de';
$rootPageUid = 1;
#$rssFeedPageType = 9818; // pageType of your RSS feed page

$GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['realurl'][$domain] = array(
    'pagePath' => array(
            'type' => 'user',
            'userFunc' => 'EXT:realurl/class.tx_realurl_advanced.php:&tx_realurl_advanced->main',
            'spaceCharacter' => '-',
            'languageGetVar' => 'L',
            'expireDays' => '3',
            'rootpage_id' => $rootPageUid,
            'firstHitPathCache' => 1
    ),
    'init' => array(
            'enableCHashCache' => TRUE,
            'respectSimulateStaticURLs' => 0,
            'appendMissingSlash' => 'ifNotFile,redirect',
            'adminJumpToBackend' => TRUE,
            'enableUrlDecodeCache' => TRUE,
            'enableUrlEncodeCache' => TRUE,
            'emptyUrlReturnValue' => '/',
    ),
    'fileName' => array(
            'defaultToHTMLsuffixOnPrev' => 0,
            'acceptHTMLsuffix' => 1,
            'index' => array(
#                        'feed.rss' => array(
#                                'keyValues' => array(
#                                       'type' => $rssFeedPageType,
#                               )
#                        )
            )
    ),
    'preVars' => array(
            array(
                    'GETvar' => 'L',
                    'valueMap' => array(
#                                'en' => '1',
                    ),
                    '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' => "CONCAT(uid, '-', IF(path_segment!='',path_segment,title))",
                        /** OR ***************/
                        'alias_field' => 'IF(path_segment!="",path_segment,title)',
                        /** OR ***************/
                        'alias_field' => "CONCAT(uid, '-', title)",

                        'addWhereClause' => ' AND NOT deleted',
                        'useUniqueCache' => 1, # 1?
                        'useUniqueCache_conf' => array(
                            'strtolower' => 1,
                            'spaceCharacter' => '-'
                        ),
                        'languageGetVar' => 'L',
                        'languageExceptionUids' => '',
                        'languageField' => 'sys_language_uid',
                        'transOrigPointerField' => 'l10n_parent',
                        'expireDays' => 180,

                    ),
                    #Depends ?  
                    array(
                        'GETvar' => 'tx_news_pi1[day]',
                        'noMatch' => 'bypass',
                    ),
                    array(
                        'GETvar' => 'tx_news_pi1[month]',
                        'noMatch' => 'bypass',
                    ),
                    array(
                        'GETvar' => 'tx_news_pi1[year]',
                        'noMatch' => 'bypass',
                    ),
                ),
                'newsCategoryConfiguration' => array(
                    array(
                        'GETvar' => 'tx_news_pi1[overwriteDemand][categories]',
                        'lookUpTable' => array(
                            'table' => 'sys_category',
                            'id_field' => 'uid',
                            'alias_field' => 'title',
                            'addWhereClause' => ' AND NOT deleted',
                            'useUniqueCache' => 1,
                            'useUniqueCache_conf' => array(
                                'strtolower' => 1,
                                'spaceCharacter' => '-'
                            )
                        )
                    )
                ),
                'newsTagConfiguration' => 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' => '-'
                            )
                        )
                    )
                ),
                #TODO: ID-News Seite Finden
                #'145' => 'newsDetailConfiguration',
                #'147' => 'newsDetailConfiguration', // For additional detail pages, add their uid as well
                #'134' => 'newsDetailConfiguration', // For additional detail pages, add their uid as well
                '148' => 'newsDetailConfiguration', // For additional detail pages, add their uid as well
                '149' => 'newsDetailConfiguration', // For additional detail pages, add their uid as well
                #'71' => 'newsTagConfiguration',
                #'72' => 'newsCategoryConfiguration',
        ),
        'postVarSets' => array(
            '_DEFAULT' => array(
                'controller' => array(
                    array(
                        'GETvar' => 'tx_news_pi1[action]',
                        'noMatch' => 'bypass'
                    ),
                    array(
                        'GETvar' => 'tx_news_pi1[controller]',
                        'noMatch' => 'bypass'
                    )
                ),

                'dateFilter' => array(
                    array(
                        'GETvar' => 'tx_news_pi1[overwriteDemand][year]',
                    ),
                    array(
                        'GETvar' => 'tx_news_pi1[overwriteDemand][month]',
                    ),
                ),
                'page' => array(
                    array(
                        'GETvar' => 'tx_news_pi1[@widget_0][currentPage]',
                    ),
                ),
            ),
        ),
    )
);

But still there are the tx_news_pi1[day], tx_news_pi1[month], tx_news_pi1[year] and cHash Parameters in the URL. Please Help me to get rid of them.

2
yes, i found that document earlier but i don't quite get it I guess. I mean where do I put that Data, there are so many arrays.BitKoch
why do you have tx_realurl_pathsegment added to your rootline fields? (second line)Bernd Wilke πφ
Its in the Advanced Example.BitKoch

2 Answers

1
votes

thats my configuration:

<?php
$GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['realurl']=array (
    '_DEFAULT' => array (
        'init' => array (
            'appendMissingSlash' => 'ifNotFile,redirect',
             'emptyUrlReturnValue' => '/',
        ),
        'pagePath' => array (
            'rootpage_id' => '2',
        ),
        'fileName' => array (
            'defaultToHTMLsuffixOnPrev' => 0,
            'acceptHTMLsuffix' => 1,
            'index' => array (
                'print' => array (
                    'keyValues' => array (
                        'type' => 98,
                     ),
                 ),
             ),
        ),
        'preVars' => array(
            array(
                'GETvar' => 'L',
                'valueMap' => array(
                    'en' => '1',
                ),
                'noMatch' => 'bypass',
            ),
            array(
                'GETvar' => 'no_cache',
                'valueMap' => array(
                    'nc' => 1,
                ),
                'noMatch' => 'bypass',
            ),
        ),
        'fixedPostVars' => array(
            // config for single/detail news: 
            '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' => 'concat(uid,\'_\',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,
                    )
                )
            ),
            // config for category selection: 
            'newsCategoryConfiguration' => array(
                array(
                    'GETvar' => 'tx_news_pi1[overwriteDemand][categories]',
                    'lookUpTable' => array(
                        'table' => 'sys_category',
                        'id_field' => 'uid',
                        'alias_field' => 'title',
                        'addWhereClause' => ' AND NOT deleted',
                        'useUniqueCache' => 1,
                        'useUniqueCache_conf' => array(
                            'strtolower' => 1,
                            'spaceCharacter' => '-'
                        )
                    )
                )
            ),
            // configuration for tag selection:
            'newsTagConfiguration' => 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' => '-'
                        )
                    )
                )
            ),
            // add your page uids where you have detail view of news:
            '70' => 'newsDetailConfiguration',
            //'701' => 'newsDetailConfiguration', // For additional detail pages, add their uid as well
            /connect page uid for further views: tag-selection, category-selection"
            '71' => 'newsTagConfiguration',
            '72' => 'newsCategoryConfiguration',
        ),
        'postVarSets' => array(
            '_DEFAULT' => array(
                'controller' => array(
                    array(
                        'GETvar' => 'tx_news_pi1[action]',
                        'noMatch' => 'bypass'
                    ),
                    array(
                        'GETvar' => 'tx_news_pi1[controller]',
                        'noMatch' => 'bypass'
                    )
                ),

                'dateFilter' => array(
                    array(
                        'GETvar' => 'tx_news_pi1[overwriteDemand][year]',
                    ),
                    array(
                        'GETvar' => 'tx_news_pi1[overwriteDemand][month]',
                    ),
                ),
                'page' => array(
                    array(
                        'GETvar' => 'tx_news_pi1[@widget_0][currentPage]',
                    ),
                ),
            ),
        ),
    ),
);

look for the right insertion in the array. For that have a clean indention!

0
votes

The already mentioned link is quite useful and contains detailed info: https://docs.typo3.org/typo3cms/extensions/news/AdministratorManual/BestPractice/Realurl/Index.html

There are 3 ways explained there:

  1. a basic one which still shows action and controller name as an URL path segment
  2. an advanced example (the one Bernd Wilke is using in his sample as well)
  3. a TypoScript solution to avoid controller and action name in URL

Option 2 can only be used if you show your detail news on a dedicated pages (separate page for list and detail view) as you configure a preset for a controller and action name for a special page (uid) - your news detail view.

Option 3 basically does the same as Option 2, but on a TypoScript level and it can be used in a case where list and detail view is on one single page. Both options can / should be used in combination with the setting skipControllerAndAction = 1.

In case you want to use the basic setup. The postVarSets is on the same level as fixedPortsVars or preVars

Additional hint: Do you use any other language than DE or EN as your default language? If so your default language has sys language uid of 0 and thus all good. The default language usually has sys language uid of 0. If you do not need a default language path segment, you leave it out in our real url config thus it gets bypassed. More info on language setup: https://github.com/dmitryd/typo3-realurl/wiki/Notes-for-Integrators#configuring-languages

RealUrl Doc: https://github.com/dmitryd/typo3-realurl/wiki