TYPO3中的realurl,重定向和缓存问题 [英] Issue with realurl, redirect and caching in TYPO3

查看:95
本文介绍了TYPO3中的realurl,重定向和缓存问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

此错误在带有piBase扩展名和realurl 2.0.15的TYPO3 7.6.10中发生:

This error occures in TYPO3 7.6.10 with a piBase extension and realurl 2.0.15:

在此扩展程序中,我正在检查GET参数,例如一个国家.如果未提供此参数,我将重定向到同一页面,并将默认国家/地区作为参数:

In this extension, I'm checking for a GET parameter, e.g. a country. If this parameter is not provided, I redirect to the same page, with default country as parameter:

if(!$this->piVars['country']) {
  $this->piVars['country'] = 'germany';
  \TYPO3\CMS\Core\Utility\HttpUtility::redirect($this->pi_linkTP_keepPIvars_url(array(), true), \TYPO3\CMS\Core\Utility\HttpUtility::HTTP_STATUS_303);
}

这意味着访问者例如呼叫网址www.mypage.com/list/并重定向到www.mypage.com/list/germany/

That means, the visitor e.g. calls url www.mypage.com/list/ and is redirected to www.mypage.com/list/germany/

这可以正常工作,但是经过一段时间并且某些访问者进入页面后,重定向停止工作.在浏览器中打开www.mypage.com/list/时,将显示某个国家/地区的页面(不是默认的页面,例如国家/地区"france").这意味着,TYPO3在页面www.mypage.com/list/france/上创建了页面www.mypage.com/list/的缓存条目,但是对于该URL,由于重定向,因此永远不会创建缓存条目

This works fine, but after some time passes and some visitors were an the page, the redirect stopped working. When opening www.mypage.com/list/ in the browser, the page is displayed for some country (not the default one, e.g. for country "france"). That means, TYPO3 creates on page www.mypage.com/list/france/ a cache entry for page www.mypage.com/list/, but for this url, a cache entry should've never been created, because of the redirect.

我可以通过将页面的缓存时间设置为1分钟来重现此错误.然后,我等待一分钟,然后加载网址www.mypage.com/list/france/.现在,当打开www.mypage.com/list/时,没有重定向,并且显示了法国.

I can reproduce this error by setting caching time of the page to 1 minute. Then I wait one minute, then loading the url www.mypage.com/list/france/. Now, when opening www.mypage.com/list/, there is no redirect and france is shown.

在禁用realurl时(或仅从realurl配置中删除参数"country"),不会发生此错误.

When disabling realurl (or just removing parameter "country" from realurl configuration), this error doesn't occur.

推荐答案

问题在这里描述: realurl生成没有cHash的条目

从2.0.15版本开始,realurl不会为链接计算cHash参数,链接可以直接访问,并且需要cHash参数来显示正确的缓存内容,例如记录的详细信息页面.

Since version 2.0.15, realurl doesn't calculate the cHash parameter for links, which are accessed directly and which need a cHash parameter to show the right cached contents, like detail pages of a record.

这篇关于TYPO3中的realurl,重定向和缓存问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆