Pretty URLs / Trailing slash not working correct

Project url www.stayery.de

Hello,

My project has a lot of urls like this.

/berlin/
/frankfurt/
etc.

We like to have trailing slashes enabled and checked PrettyUrls to enable redirect 301 from
/frankfurt to /frankfurt/

From here I learned that redirecting with 301 in netlify.toml, to get trailing slashes, will not work.
trailing slash docs

But why the PrettyUrls redirecting feature is not working for me?
For example:
I get no 301 redirect for the folloing url with Pretty Urls enabled.

www.stayery.de/frankfurt does not redirect(301) to: www.stayery.de/frankfurt/
From without trainling slash to with trailing slash?
This leads to duplicated contetent for /frankfurt and /frankfurt/
There are a lot of other urls in our project with the same problem. This is why the topic is huge for us.

Please help.

sideinfo:
To get the content for /frankfurt
Im using the netlify proxy, who gets the content from a content management server outside of netlify.

netlify.toml
[[redirects]]
from = “/frankfurt/*”
to = “https://typo3.stayery.de/frankfurt/:splat
status = 200
force = true

Netlify Gatsby Plugin is enabled also netlify DNS

Thanks a lot

@tom_morello I’m having trouble understanding, can you clean up the formatting of your question.

For example, I don’t know what you mean by **/** in regards to a Netlify redirect, and am wondering if you’ve accidentally written those using a glob syntax.

Hello,

Sorry.

I corrected the bad parts.
Hopefully its clear now.

Kind Regards,

@tom_morello Netlify uses trailing slashes when the files are within folders.

It can be summed up with…
/folder/index.html = /folder/
/folder.html = /folder

Default

Pretty URLs

My case is different.

I’m using the netlify proxy to get the HTML documents from a cms of a partner company.
The cms server (typo3) answers on the request:
GET typo3.stayery.de/frankfurt
with a redirect(301) to
GET typo3.stayery.de/frankfurt/

The netlify proxy gets this information in the background, but does not deliver the redirect to the user, which lead to the problem that we have no redirect to

(with trailing slash) when we call
GET STAYERY Frankfurt | Serviced Apartments in Frankfurt Sachsenhausen

The redirect from the cms server, can be tested with a direct request to
GET typo3.stayery.de/frankfurt
with header set to : X-Host = “www.stayery.de
Only with this header a request is allowed ! And you will get the redirect.

Here my netlify.toml part for this


[[redirects]]
from = “/frankfurt/*”
to = “https://typo3.stayery.de/frankfurt/:splat
status = 200
force = true
headers = {X-Host = “www.stayery.de” }

Question:
How can I redirect to STAYERY Frankfurt | Serviced Apartments in Frankfurt Sachsenhausen
with trailing
when the content comes from different Server and ist delivered over netlify proxy request.
I have in this case a folder or files on netlify, only the proxy configuration controls what happens.

I believe I understand the issue, and can’t provide any suggestions.

This may be a related thread: