# Consistent trailing slashes on all URLs

**URL:** <https://answers.netlify.com/t/consistent-trailing-slashes-on-all-urls/25351>\
**Category:** Support\
**Tags:** redirects\
**Created:** [October 28, 2020, 4:44pm UTC](https://answers.netlify.com/t/consistent-trailing-slashes-on-all-urls/25351 "2020-10-28T16:44:48Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![sel](https://sea1.discourse-cdn.com/netlify/user_avatar/answers.netlify.com/sel/32/14545_2.png) [@sel](https://answers.netlify.com/u/sel)\
**Post date:** [October 28, 2020, 4:44pm UTC](https://answers.netlify.com/t/consistent-trailing-slashes-on-all-urls/25351/1 "2020-10-28T16:44:48Z")

</div>

I have a site up on Netlify with pages such as [https://stormbrands.co/work](https://stormbrands.co/work) and [https://stormbrands.co/work/air-partner](https://stormbrands.co/work/air-partner)

I would like these pages so they always end in a trailing slash, i.e. [https://stormbrands.co/work/](https://stormbrands.co/work/) and [https://stormbrands.co/work/air-partner/](https://stormbrands.co/work/air-partner/)

I have enabled Asset Optimisation \> Pretty URLs. But that doesn’t seem to have done anything.

The site is built with Vue.js so this is what my \_redirects file looks like:

```auto
/* /index.html 200

```

Is it possible to do this with Netlify? I found this which is not what I consider to be a valid fix: [How I fixed the trailing slash in Netlify rewrites](https://flaviocopes.com/netlify-fix-trailing-slash-rewrite/)

---

<div class="post-metadata">

**Author:** ![hrishikesh](https://sea1.discourse-cdn.com/netlify/user_avatar/answers.netlify.com/hrishikesh/32/74607_2.png) [@hrishikesh](https://answers.netlify.com/u/hrishikesh)\
**Post date:** [October 28, 2020, 6:21pm UTC](https://answers.netlify.com/t/consistent-trailing-slashes-on-all-urls/25351/2 "2020-10-28T18:21:45Z")

</div>

> [@sel](#):
>
> I have enabled Asset Optimisation \> Pretty URLs

Did you deploy your website again after you enabled the option?

---

<div class="post-metadata">

**Author:** ![sel](https://sea1.discourse-cdn.com/netlify/user_avatar/answers.netlify.com/sel/32/14545_2.png) [@sel](https://answers.netlify.com/u/sel)\
**Post date:** [October 28, 2020, 7:20pm UTC](https://answers.netlify.com/t/consistent-trailing-slashes-on-all-urls/25351/3 "2020-10-28T19:20:23Z")

</div>

I’ve sinced made new commits to the repo which have been published, yes. Is that what you mean?

---

<div class="post-metadata">

**Author:** ![hrishikesh](https://sea1.discourse-cdn.com/netlify/user_avatar/answers.netlify.com/hrishikesh/32/74607_2.png) [@hrishikesh](https://answers.netlify.com/u/hrishikesh)\
**Post date:** [October 29, 2020, 5:16am UTC](https://answers.netlify.com/t/consistent-trailing-slashes-on-all-urls/25351/4 "2020-10-29T05:16:38Z")

</div>

Not exactly a solution, but, here’s an another (kind of similar) discussions:

> [@Netlify pretty urls won't strip .html extension](https://answers.netlify.com/t/netlify-pretty-urls-wont-strip-html-extension/13063/):
>
> I am trying to deploy a static website. I have activated the pretty url option but all my pages are still available with the .html, or /index.html for directories, in addition to the url-less version. I have read in the docs about redirects and rewrites that url prettifying should be handled via this option, but I can’t make it work and having both urls, with and without extension is really bas SEO-wise. What am I missing? PS: site name → [laughing-swirles-e5cbea.netlify.app](https://laughing-swirles-e5cbea.netlify.app) Thanks …

and

> [@Confused by Pretty Url behavior](https://answers.netlify.com/t/confused-by-pretty-url-behavior/5279):
>
> Hello, I’m confused at what the Pretty Url is supposed to be doing. Or more specifically, what is Netlify default behavior when this option is not enabled. I have a website available at [https://gamemaster.pixelastic.com/](https://gamemaster.pixelastic.com/) (which actually serves [https://gamemaster-pixelastic.netlify.com/](https://gamemaster-pixelastic.netlify.com/)). I have created a test.html file at the root of this website. From my test, the file is accessible through: [https://gamemaster.pixelastic.com/test.html](https://gamemaster.pixelastic.com/test.html) and [https://gamemaster-pixelastic.netlify.com/test.htm…](https://gamemaster-pixelastic.netlify.com/test.html)

The gist being, if you link to a URL without the trailing slash or if the user types the URL without the trailing slash, it would still be served. With Pretty URLs feature, it’s not actually redirecting, instead it’s just modifying links in your HTML to remove `.html` extension. But since, you have not linked with the `.html` extension, it is not changing the HTML anymore as it’s already ‘pretty’.

That’s what I understood from that thread. So, if that’s what it is, you might have to update your links to add trailing slashes to them. This would mean, users who use your internal website navigation would only land on pages with the trailing slash, however, if someone removes the trailing slash and tries to access the page, it would still be visible.

---

<div class="post-metadata">

**Author:** ![sel](https://sea1.discourse-cdn.com/netlify/user_avatar/answers.netlify.com/sel/32/14545_2.png) [@sel](https://answers.netlify.com/u/sel)\
**Post date:** [October 29, 2020, 10:04am UTC](https://answers.netlify.com/t/consistent-trailing-slashes-on-all-urls/25351/5 "2020-10-29T10:04:10Z")

</div>

OK, thanks. I understand, although quite frustrating given it would be 2 lines of Apache / nginx code. And disappointing given the impact this will have on SEO.

Given the number of threads there are on this community about the topic, surely Netlify can find a solution?

---

<div class="post-metadata">

**Author:** ![hrishikesh](https://sea1.discourse-cdn.com/netlify/user_avatar/answers.netlify.com/hrishikesh/32/74607_2.png) [@hrishikesh](https://answers.netlify.com/u/hrishikesh)\
**Post date:** [October 29, 2020, 10:06am UTC](https://answers.netlify.com/t/consistent-trailing-slashes-on-all-urls/25351/6 "2020-10-29T10:06:43Z")

</div>

There’s a bit of work you can do on your end to fix SEO too. Canonical links can help you with that. Surely this isn’t a solution to the problem, but, for the time being, you can work with that. More about it here: [Improved SEO with canonical link headers](https://answers.netlify.com/t/improved-seo-with-canonical-link-headers/11095)

---

<div class="post-metadata">

**Author:** ![sel](https://sea1.discourse-cdn.com/netlify/user_avatar/answers.netlify.com/sel/32/14545_2.png) [@sel](https://answers.netlify.com/u/sel)\
**Post date:** [November 25, 2020, 10:29am UTC](https://answers.netlify.com/t/consistent-trailing-slashes-on-all-urls/25351/7 "2020-11-25T10:29:58Z")

</div>

Hi there. I know it’s only been 1 month, but I wanted to find out if there has been any solution to this problem. I’m getting a lot of criticism from my SEO agency about this. We’ve implemented the fix aforementioned in [How I fixed the trailing slash in Netlify rewrites](https://flaviocopes.com/netlify-fix-trailing-slash-rewrite/) but they are demanding 301 redirects.

The only thing I can think of at the moment is to move my site to a traditional nginx / Apache host. Please can you help!?

---

<div class="post-metadata">

**Author:** ![fool](https://sea1.discourse-cdn.com/netlify/user_avatar/answers.netlify.com/fool/32/37_2.png) [@fool](https://answers.netlify.com/u/fool)\
**Post date:** [November 30, 2020, 12:34am UTC](https://answers.netlify.com/t/consistent-trailing-slashes-on-all-urls/25351/8 "2020-11-30T00:34:19Z")

</div>

I don’t believe we have anything better than that for those specific requirements today, @sel. Sorry I don’t have better news for you!

---

<div class="post-metadata">

**Author:** ![jonsully](https://sea1.discourse-cdn.com/netlify/user_avatar/answers.netlify.com/jonsully/32/15053_2.png) [@jonsully](https://answers.netlify.com/u/jonsully)\
**Post date:** [December 29, 2020, 7:40am UTC](https://answers.netlify.com/t/consistent-trailing-slashes-on-all-urls/25351/9 "2020-12-29T07:40:15Z")

</div>

Hey @sel 👋🏻

I just wrote up a pretty comprehensive article walking through the steps required to get trailing slashes working everywhere. Might be worth a read for you:

> **[Trailing Slashes on Netlify](https://jonsully.net/blog/trailing-slashes-on-netlify/)**
>
> The descriptive guide, with particular instructions for Gatsby, Next.js, and other PWAs

Otherwise, I checked out your site and, assuming you still have “Pretty URLs” still enabled for your site, I think what I can see from some CLI HTTP requests is that you’re missing a nesting layer. In canonical / historical web parlance, a URL’s path with a trailing slash represented a directory and a path without represented a document. The “Pretty URLs” feature helps accommodate that history but still adheres to it. If you have a document, `/work/equall.html`, Pretty URLs will convert it to `/work/equall` but not add a trailing slash because it’s a document, not a directory.

If instead you rename that file `index.html` and nest it inside a named folder, Pretty URLs will enforce a slash and treat it like a directory. E.g. change `/work/equall.html` to `/work/equall/index.html`. In this case, Pretty URLs is _always_ going to enforce a trailing slash because the user is looking at a directory, not a single document.

I hope that makes sense and helps. No \_redirects or anything needed!

–  
Jon
