URL's Redirection problem


I am writing to you because I have a problem with my website.

Since I published it on netlify, I have a lot of coverage problems in the google index, because it redirects the url’s without trailing slash, to the same address with trailing slash.

I have been reviewing the documentation and testing for some time without getting it to work.

I want to do a 301 redirection for all urls without trailing slash to the same url with trailing slash.

I have tried this:

https://sad-clarke-e76a78.netlify.com/* https://mycustomdomain.com/:splat 301!

But nothing has changed.

I’ve tried this:
https://mycustomdomain.com/* https://mycustomdomain.com/:splat 301!

But it gives a too many redirections error.

I don’t know what else to try… Can you help me, please?

Thank you very much.

@tnieto Welcome to the Netlify community. Have you tried turning on Asset Optimization in the Build & Deploy section of the dashboard for this site?

seems it is currently turned off - that is also my best suggestion - enabling “Pretty URLs” here: https://app.netlify.com/sites/sad-clarke-e76a78/settings/deploys#asset-optimization

This may not work, but you can turn it off and on without a deploy to see if the behavior seems better.

Dear @gregraven and @fool,

Thank you for your answers and I apologize for the delay in answering you.

A few months ago I tried to activate the option “Pretty URLs”, I let some time pass (3 months approximately) to try but it didn’t work. So I turned it off again. I’ve turned it back on to try again, but I don’t have much hope that it will solve my problem.

That’s why I considered as last possibility before moving the site to other static hosting, to add the redirection I mentioned in the _redirects file of the site.


Hey @tnieto,

This is a very broad topic, whether a host and the infrastructure will or will not omit the trailing slash!

As our docs state, a rewrite rule ain’t gonna cut it but prettifying URLs should. As for your indexing… this should change and reflect changes when enabling pretty URLs.

Ok @Pie,

I did the change. I’m waiting for google to reindex the site to check if it has taken effect.

Thank you!

1 Like

please let us know if it doesn’t!