Bug #56423

Page shortcuts redirect with HTTP Status 301 and get cached on some devices

Added by Christoph Dörfel almost 5 years ago. Updated 5 months ago.

Status:
Closed
Priority:
Should have
Assignee:
-
Category:
Frontend
Target version:
Start date:
2014-02-28
Due date:
% Done:

100%

TYPO3 Version:
6.2
PHP Version:
5.3
Tags:
Complexity:
easy
Is Regression:
No
Sprint Focus:

Description

We recently had the problem of iOS caching redirects caused by the page shortcut mode "link to first subpage".

In TypoScriptFrontendController::checkPageForShortcutRedirect() the only exception from the standard 301 redirect is SHORTCUT_MODE_RANDOM_SUBPAGE, which is a 307 redirect.
I believe that all shortcut modes except for SHORTCUT_MODE_NONE should be handled as 307 redirects, since shortcuts are dynamic and subject to change.

Of course SEO experts won't be too happy about such a code change but at least the chance for errors would be reduced significantly (and developers' headaches too).


Related issues

Related to TYPO3 Core - Feature #73139: Allow to select redirect code for doktype shortcut Rejected 2016-02-05
Related to TYPO3 Core - Bug #73148: Wrong HTTP redirect statuscode for shortcut to selected page Rejected 2016-02-05
Duplicated by TYPO3 Core - Bug #54508: Http Redirect 301 prevents browsers from retrieving the correct url after authentication Closed 2013-12-19

Associated revisions

Revision d404982b (diff)
Added by Christoph Dörfel almost 5 years ago

[BUGFIX] Use HTTP Status 307 for all page shortcut modes

Fixes cases where the shortcut page is cached by some
devices leading to exceptions or wrong behaviour.

Resolves: #56423
Releases: 6.2
Change-Id: I71252b13320417ecffa9c28db6af9476d667d58f
Reviewed-on: https://review.typo3.org/27933
Reviewed-by: Xavier Perseguers
Tested-by: Xavier Perseguers
Reviewed-by: Markus Klein
Tested-by: Markus Klein

History

#1 Updated by Gerrit Code Review almost 5 years ago

  • Status changed from New to Under Review

Patch set 1 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/27933

#2 Updated by Gerrit Code Review almost 5 years ago

Patch set 2 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/27933

#3 Updated by Gerrit Code Review almost 5 years ago

Patch set 3 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/27933

#4 Updated by Christoph Dörfel almost 5 years ago

  • Status changed from Under Review to Resolved
  • % Done changed from 0 to 100

#5 Updated by Mario Colombo over 4 years ago

Is this really a good idea?

Please read https://forge.typo3.org/issues/15128

#6 Updated by Christoph Dörfel over 4 years ago

Mario Colombo wrote:

Is this really a good idea?

Please read https://forge.typo3.org/issues/15128

Hi Mario

From a technical point of view (NOT a SEO point of view as I stated before) this is the correct behaviour (using a temporary redirect on a link that is subject to change).
IMHO the method of redirection should be configurable (to a 301 redirect if you so desire) but the default behaviour should be a temporary redirect because this solves some serious technical problems (blame iOS).

Can we agree on making a feature request for choosing the type of redirect (or setting it globally through TYPO3_CONF_VARS)? That would be the best solution for both of us I guess :)

#7 Updated by Mathias Brodala about 4 years ago

Somehow the link to the review server results in "Not found". Can someone fix this?

#8 Updated by Lars Zimmermann about 4 years ago

Hi guys,

TYPO3 seems to use HTTP Status 307 for all page shortcut modes. This is really bad from a SEO point of view as stated above. Could you pls make this at least configurable for people who still want to use a 301 HTTP status for the starting page shortcut?

Thank you very much!
Lars

#9 Updated by Johannes Hahn over 3 years ago

Hi,
i give Lars Zimmermann my vote.

I think it's a bad practice to change this hardcoded to 307.
This bugfix does not fix the problem. It causes the next generation of bugs.

Why not write it like in the jumpUrl function: same php file near line: 3029

  1. code example #####
    $statusCode = HttpUtility::HTTP_STATUS_301;
    if ($TSConf['TSFE.']['jumpURL_HTTPStatusCode']) {
    switch ((int)$TSConf['TSFE.']['jumpURL_HTTPStatusCode']) {
    case 301:
    $statusCode = HttpUtility::HTTP_STATUS_301;
    break;
    case 302:
    $statusCode = HttpUtility::HTTP_STATUS_302;
    break;
    case 307:
    $statusCode = HttpUtility::HTTP_STATUS_307;
    break;
    }
    }
  2. code example #####

ps.: from seo view this line is also not really correct.
//jumpUrl function:
3099: $statusCode = HttpUtility::*HTTP_STATUS_303*;
if ($TSConf['TSFE.']['jumpURL_HTTPStatusCode']) {
...

#10 Updated by Dan Untenzu almost 3 years ago

Hey guys, you may want to take a look into https://forge.typo3.org/issues/73148#note-8 if you still need 301 redirects.

#11 Updated by Benni Mack 5 months ago

  • Status changed from Resolved to Closed

Also available in: Atom PDF