Issue Bug Under Review Orphaned

#99217Pagetypes not working with trailing Slashes if default PageTypeSuffix is set

Oliver Krammer 11/29/22, 09:48 updated 04/22/26, 06:33

Description

I use Pagetypes for Ajax Calls then this example Url work:

dasisteine/url?mitparement=1&type=93939

and that will not work

dasisteine/url/?mitparement=1&type=93939

i debugged thru the code and found that this
https://github.com/TYPO3/typo3/blob/1b0fea17a5591de55e9c49ca3dd563d8cb95c245/typo3/sysext/core/Classes/Routing/Enhancer/PageTypeDecorator.php#L[…]18
will set the Type to 0 because in my site config i have set this:

PageTypeSuffix:
  type: PageType
  default: /
  suffix: /
  index: ''
  map:
    /: 0
But i think that ist wrong. If i have an Parameter set with type i want to use this and not the default…

Reviews 3

History 711

  1. Riccardo De Contardi commented and changed category status New Needs Feedback <span data-processor="relativetime" data-value="2025-04-05T10:32:58+00:00" > 04/05/25, 10:32 </span>

    Could you try with a recent TYPO3 version like 13 or 14.0.0-dev? I think it has been fixed in the meanwhile.

    Thank you

  2. Tim Obert commented <span data-processor="relativetime" data-value="2025-07-23T06:21:13+00:00" > 07/23/25, 06:21 </span>

    Riccardo De Contardi wrote in #note-1:
    > Could you try with a recent TYPO3 version like 13 or 14.0.0-dev? I think it has been fixed in the meanwhile.
    >
    > Thank you

    Unfortunately, it is not solved in my tests. ‘?type=’ is ignored if default: / is set. The PageType is then always 0.

  3. Ayke Halder commented <span data-processor="relativetime" data-value="2025-08-14T09:58:16+00:00" > 08/14/25, 09:58 </span>

    I think about different configuration variations:

    No default trailing slash

    PageTypeSuffix:
      type: PageType
      default: ''
      index: ''
      map:
        'sitemap.xml': 1533906435

    Result

    All of these are already working as expected.

    • example.org/someurl —> type=0
    • example.org/someurl/ —> type=0
    • example.org/someurl/sitemap.xml —> type=1533906435
    • example.org/someurl?type=1533906435 —> type=1533906435
    • example.org/someurl/?type=1533906435 —> type=1533906435
    • example.org/someurl?type=13 —> type=13
    • example.org/someurl/?type=13 —> type=13

    Default trailing slash

    PageTypeSuffix:
      type: PageType
      default: '/'
      index: ''
      map:
        'sitemap.xml': 1533906435

    Result

    • example.org/someurl —> type=0
    • example.org/someurl/ —> type=0
    • example.org/someurl/sitemap.xml —> type=1533906435
    • example.org/someurl?type=1533906435 —> type=1533906435
    • example.org/someurl/?type=1533906435 —> type=0 (Unexpected result!)
    • example.org/someurl?type=13 —> type=13
    • example.org/someurl/?type=13 —> type=0 (Unexpected result!)

    Result with additional .htaccess RewriteRule of non-slash to slash URLs

    • example.org/someurl —> example.org/someurl/ —> type=0
    • example.org/someurl/ —> type=0
    • example.org/someurl/sitemap.xml —> type=1533906435
    • example.org/someurl?type=1533906435 —> example.org/someurl/?type=1533906435 —> type=0 (Unexpected result!)
    • example.org/someurl/?type=1533906435 —> type=0 (Unexpected result!)
    • example.org/someurl?type=13 —> example.org/someurl/?type=13 —> type=0 (Unexpected result!)
    • example.org/someurl/?type=13 —> type=0 (Unexpected result!)

    Default trailing slash – with enforced slash-to-type-0 mapping

    This configuration should be used if you can ensure that you have proper type-mappings configured for all and every type in use.

    PageTypeSuffix:
      type: PageType
      default: '/'
      index: ''
      map:
        '/': 0
        'sitemap.xml': 1533906435

    Result

    • example.org/someurl —> type=0
    • example.org/someurl/ —> type=0
    • example.org/someurl/sitemap.xml —> type=1533906435
    • example.org/someurl?type=1533906435 —> type=1533906435 (Biased result – unsure what is expected here: type=1533906435 or type=0)
    • example.org/someurl/?type=1533906435 —> type=0 (Expected result: type 0 is enforced for traling slash in configuration)
    • example.org/someurl?type=13 —> type=13 (Biased result – unsure what is expected here: type=13 or type=0)
    • example.org/someurl/?type=13 —> type=0 (Expected result: type 0 is enforced for traling slash in configuration)

    Result with additional .htaccess RewriteRule of non-slash to slash URLs

    • example.org/someurl —> type=0
    • example.org/someurl/ —> type=0
    • example.org/someurl/sitemap.xml —> type=1533906435
    • example.org/someurl?type=1533906435 —> example.org/someurl/?type=1533906435 —> type=0 (Expected result: type 0 is enforced for traling slash in configuration)
    • example.org/someurl/?type=1533906435 —> type=0 (Expected result: type 0 is enforced for traling slash in configuration)
    • example.org/someurl?type=13 —> example.org/someurl/?type=13 —> type=0 (Expected result: type 0 is enforced for traling slash in configuration)
    • example.org/someurl/?type=13 —> type=0 (Expected result: type 0 is enforced for traling slash in configuration)

    Appendix: .htaccess RewriteRule of non-slash to slash URLs

        # If the file/symlink/directory does not exist and url has no dot and no trailing slash => Redirect to url with trailing slash.
        RewriteCond %{REQUEST_FILENAME} !-f
        RewriteCond %{REQUEST_FILENAME} !-d
        RewriteCond %{REQUEST_FILENAME} !-l
        RewriteRule ^(.+/)?[^./]+$ %{REQUEST_URI}/ [QSA,R=301,L]

    Also see #89552

  4. Gerrit Code Review pushed patch set 6 for main to change 90374 status Needs Feedback Under Review <span data-processor="relativetime" data-value="2025-08-14T10:44:46+00:00" > 08/14/25, 10:44 </span>