Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Working RealUrl Configuration #44

Closed
chequille opened this issue Apr 5, 2019 · 7 comments
Closed

Working RealUrl Configuration #44

chequille opened this issue Apr 5, 2019 · 7 comments

Comments

@chequille
Copy link

Hi,

Using Typo3 8.7.24
Blog 8.7.4 and
RealURL 2.5.0

I found some configuration examples for RealURL and the Blog extension, but none of them worked.
Does somebody have a working config to get good looking URLS for the combination listetd above?

Would be great.

Best regards,
Jürgen

@abeutel
Copy link

abeutel commented Apr 6, 2019

Did you already try the autoconfig included in EXT:blog? See the configuration example in TYPO3 Backend > System > Blog:

RealURL Setup

The blog extension provides a configuration for EXT:realurl. To get nice looking URLs add the following realurl configuration to your project setup:

'fixedPostVars' => [
    '<UID_CATEGORY_PAGE>' => 'tx_blog_category',
    '<UID_TAG_PAGE>' => 'tx_blog_tag',
    '<UID_ARCHIVE_PAGE>' => 'tx_blog_archive'
]

Which would be something like the example below with 1,2 and 3 being the page uids.

$GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['realurl'] = [
    '_DEFAULT' => [
        'fixedPostVars' => [
            '1' => 'tx_blog_category',
            '2' => 'tx_blog_tag',
            '3' => 'tx_blog_archive',
        ]
    ]	
];

The above example will override the complete RealURL config, don't copy and paste. It's just to get the idea where to put the config.

@chequille
Copy link
Author

Hi Andreas,
fthanks for the reply, but this is what I did with an example I found. I enhanced my existion realurl config with the the above stuff and what I found on another site.
Resulting url looks like below:

<?php

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

// Adjust to your needs
$domain = 'xxxxxxxxxxxxxxxx';
$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',
                        		'de' => '0'
                        ),
                        'noMatch' => 'bypass',
                ),
                array(
                        'GETvar' => 'no_cache',
                        'valueMap' => array(
                                'nc' => 1,
                        ),
                        'noMatch' => 'bypass',
                ),
        ),
        'fixedPostVars' => array(

        		'tx_blog_tag' => array(
        				array(
        						'GETvar' => 'tx_blog_tag[tag]',
        						'lookUpTable' => array(
        								'table' => 'tx_blog_domain_model_tag',
        								'id_field' => 'uid',
        								'alias_field' => 'title',
        								'useUniqueCache' => 1,
        								'useUniqueCache_conf' => array(
        										'strtolower' => 1,
        										'spaceCharacter' => '-',
        								),
        								'noMatch' => 'bypass',
        						),
        				),
        		),
        		'tx_blog_category' => array(
        				array(
        						'GETvar' => 'tx_blog_category[category]',
        						'lookUpTable' => array(
        								'table' => 'sys_category',
        								'id_field' => 'uid',
        								'alias_field' => 'title',
        								'useUniqueCache' => 1,
        								'useUniqueCache_conf' => array(
        										'strtolower' => 1,
        										'spaceCharacter' => '-',
        								),
        								'noMatch' => 'bypass',
        						),
        				)
        		),
        		'tx_blog_author' => array(
        				array(
        						'GETvar' => 'tx_blog_authorposts[author]',
        						'lookUpTable' => array(
        								'table' => 'tx_blog_domain_model_author',
        								'id_field' => 'uid',
        								'alias_field' => 'name',
        								'useUniqueCache' => 1,
        								'useUniqueCache_conf' => array(
        										'strtolower' => 1,
        										'spaceCharacter' => '-',
        								),
        								'noMatch' => 'bypass',
        						),
        				),
        		),
        		'tx_blog_archive' => array(
        				array(
        						'GETvar' => 'tx_blog_archive[year]',
        				),
        				array(
        						'GETvar' => 'tx_blog_archive[month]',
        						'valueMap' => array(
        								'january' => '1',
        								'february' => '2',
        								'march' => '3',
        								'april' => '4',
        								'may' => '5',
        								'june' => '6',
        								'july' => '7',
        								'august' => '8',
        								'september' => '9',
        								'october' => '10',
        								'november' => '11',
        								'december' => '12',
        						),
        				),
        		),
        		'129' => 'tx_blog_category',
        		'130' => 'tx_blog_tag',
        		'131' => 'tx_blog_author',
        		'132' => 'tx_blog_archive',
        		
                '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,
                                		'useCHashCache' => 1,
                                        'useUniqueCache_conf' => array(
                                                'strtolower' => 1,
                                                'spaceCharacter' => '-'
                                        ),
                                        'languageGetVar' => 'L',
                                        'languageExceptionUids' => '',
                                        'languageField' => 'sys_language_uid',
                                        'transOrigPointerField' => 'l10n_parent',
                                        'autoUpdate' => 1,
                                        'expireDays' => 180,
                                )
                        ),
                		array(
                				'GETvar' => 'tx_news_pi1[overwriteDemand][year]',
                		),
                		array(
                				'GETvar' => 'tx_news_pi1[overwriteDemand][month]',
                		),
                		
                ),
                'newsCategoryConfiguration' => array(
                        array(
                                'GETvar' => 'tx_news_pi1[overwriteDemand][categories]',
                                'lookUpTable' => array(
                                        'table' => 'sys_category',
                                        'id_field' => 'uid',
                                        'alias_field' => 'title',
                                        'addWhereClause' => ' AND NOT deleted',
                                		'useCHashCache' => 1,
                                        'useUniqueCache' => 1,
                                        'useUniqueCache_conf' => array(
                                                'strtolower' => 1,
                                                'spaceCharacter' => '-'
                                        )
                                )
                        ),
                        array(
                                'GETvar' => 'tx_news_pi1[overwriteDemand][year]',
                        ),
                        array(
                                'GETvar' => 'tx_news_pi1[overwriteDemand][month]',
                        ),
                ),
                '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' => '-'
                                        )
                                )
                        )
                ),
        		
                '103' => 'newsDetailConfiguration',
                '701' => 'newsDetailConfiguration', // For additional detail pages, add their uid as well
                '71' => 'newsTagConfiguration',
                '105' => '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]',
                                ),
                        ),
                		'tx_blog_feed' => array(
                				array(
                						'GETvar' => 'tx_blog_posts[controller]',
                						'valueMap' => array(
                								'posts' => 'Post',
                						)
                				),
                				array(
                						'GETvar' => 'tx_blog_posts[action]',
                						'valueMap' => array(
                								'recent' => 'listRecentPosts',
                						)
                				),
                				array(
                						'GETvar' => 'tx_blog_posts[format]',
                				),
                		),
                		'tx_blog_category' => array(
                				array(
                						'GETvar' => 'tx_blog_category[action]',
                						'noMatch' => 'bypass'
                				),
                				array(
                						'GETvar' => 'tx_blog_category[controller]',
                						'noMatch' => 'bypass'
                				)
                		),
                		'tx_blog_authorposts' => array(
                				array(
                						'GETvar' => 'tx_blog_authorposts[action]',
                						'noMatch' => 'bypass'
                				),
                				array(
                						'GETvar' => 'tx_blog_authorposts[controller]',
                						'noMatch' => 'bypass'
                				)
                		),
                		'tx_blog_tag' => array(
                				array(
                						'GETvar' => 'tx_blog_tag[action]',
                						'noMatch' => 'bypass'
                				),
                				array(
                						'GETvar' => 'tx_blog_tag[controller]',
                						'noMatch' => 'bypass'
                				)
                		),
                		'tx_blog_archive' => array(
                				array(
                						'GETvar' => 'tx_blog_archive[action]',
                						'noMatch' => 'bypass'
                				),
                				array(
                						'GETvar' => 'tx_blog_archive[controller]',
                						'noMatch' => 'bypass'
                				)
                		),
                		'129' => 'tx_blog_category',
                		'130' => 'tx_blog_tag',
                		'131' => 'tx_blog_author',
                		'132' => 'tx_blog_archive',
                		
                ),
        ),

);

Any idea what can be wrong. Maybe wrong place of the configurations?
Regards,
Jürgen

@abeutel
Copy link

abeutel commented Apr 6, 2019

Hey Jürgen,

your configuration seems to be fine. I just copied it to a project with EXT:blog installed and

  • replaced the full RealURL configuration there with yours
  • set the domain and the relevant page UIDs
  • removed the auto configuration class of EXT:blog
  • cleared all RealURL tables (truncated in DB)
  • force flushed TYPO3 caches

I get proper speaking URLs for blog, tags, authors and categories. Maybe you could try backing up your RealURL tables and truncate them (on a test environment)?

Andreas

@chequille
Copy link
Author

Hi Andreas,
thanks for this, we are getting closer !!!!!
The links now look like
hopfengut-blog/category/?tx_blog_category[category]=16&cHash=18a36c03084fe5521953363a3d990ab4
Action and Controller is gone bit still no category name.

THe only thing which I did not do is "force flushed TYPO3 caches". Can I set this in some TS Script, because i do have limited shell access and do not know if this will work.

Jürgen

@abeutel
Copy link

abeutel commented Apr 6, 2019

Hi Jürgen,

when doing a force flush using TYPO3 Console, Console also clears files in typo3temp/var/– you can safely remove this var directory by hand also.

Regarding the category: I'm sure you checked your IDs – unfortunately I've no other idea regarding your setup. RealURL stores the alias in tx_realurl_uniqalias – you could check if there are some entries for sys_category or tx_blog_domain_model_tag in this table.

Andreas

@chequille
Copy link
Author

Hi Andreas,
checked the tx_realurl_uniqalias table. There are sys_categories stored but not the ones generted for the blog.
CHecked my IDs but I think they are correct.
So far for the moment.
Jürgen

@chequille
Copy link
Author

Hi Again, do not ask why, but now it is working :-)
The only thing I did is truncate the realurl tables again and deleting the typo3temp/var again.
Nothing else.
Ok, want to say thank you again for your help.
Have a nice weekend.
Jürgen

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants