Search code examples
urlpathtypo3typo3-9.xpowermail

How to send powermail forms without 404 error on subages with TYPO3 9.5?


I try to send a simple form at a subpage, but got a 404 error. The problem does not appear at the home page of my website so I guess there is something wrong with or missing in my config.yaml file. Below is my config.yaml. Any idea anyone?

rootPageId: 1
base: 'http://www.my-domain.de/'
baseVariants:
  -
    base: 'http://www.my-domain.intern'
    condition: 'applicationContext == "Development"'
languages:
  -
    title: Deutsch
    enabled: true
    languageId: '0'
    base: /
    typo3Language: de
    locale: de_DE.UTF-8
    iso-639-1: de
    navigationTitle: Deutsch
    hreflang: de-DE
    direction: ltr
    flag: de
errorHandling:
  -
    errorCode: '404'
    errorHandler: Page
    errorContentSource: '4'

Solution

  • Ok, bug found - thanks, Chris. If I force the trailing slash in the .htaccess, I have to adjust my config.yaml accordingly. That's how it works.

    .htaccess

    <IfModule mod_rewrite.c>
        # EXTRA: Enforce trailing slash. Ignore trailing slash on file endings
        RewriteBase /
        RewriteCond %{REQUEST_FILENAME} !-f
        RewriteCond %{REQUEST_FILENAME} !-d
        RewriteCond %{REQUEST_URI} !(.*)/$
        RewriteCond %{REQUEST_FILENAME} !\.(gif|jpg|png|jpeg|css|js|xml|rss|txt)$ [NC]
        RewriteCond %{REQUEST_URI} !\.(gif|jpg|png|jpeg|css|js|xml|rss|txt)$ [NC]
        RewriteRule ^(.*[^/])$ /$1/ [L,R=301]
    </IfModule>
    

    config.yaml

    routeEnhancers:
      PageTypeSuffix:
        type: PageType
        default: '/'
        suffix: '/'
        index: ''
        map:
          '/': 0