Site configuration: map file-extension to page-type

Hello,

in site configuration, I would like to map a file extension to a page type.

For example:
have path/to/any/page.pdf map to type 101, and path/to/any/page.css map to type 35. Then I’d be able to call different ts-scripts or select different templates and generate pdf output or dynamic css.

What I’ve managed so far is to set up a static route

Static route name: /test.css
Type: Page, File or Url
value: t3://page?uid=1&type=35

This is not exactly what I had in mind.
I also have a problem with this workaround on my local test-server. For some reason, it seems that TYPO3 is using curl for the redirect instead of handling it internally. The curl request fails on my local test server because of a self signed certificate.

Kind regards

edit: I forgot to mention that I’m using TYPO3 9 for this project.
edit2: I’ve added the CA to the test-server configuration and curl is working now. I’m still wondering why curl is necessary here.

Hey Nils,

I guess what you are looking for is the PageTypeDecorator (see https://docs.typo3.org/m/typo3/reference-coreapi/10.4/en-us/ApiOverview/Routing/AdvancedRoutingConfiguration.html#page-type-decorator) which serves your purpose (that is “mapping of page types to specific endings of your URL”). Static Routes are rather suited for e.g. robots.txt which should be different on a per-domain basis in a multi-site environment.

Hope that helps.
Benni.

That’s exactly what I was looking for. Thank you!