# Pretty urls return 404 on /about instead of 301 to /about/

**URL:** <https://answers.netlify.com/t/pretty-urls-return-404-on-about-instead-of-301-to-about/135980>\
**Category:** Support\
**Tags:** redirects, netlify-newbie\
**Created:** [January 2, 2025, 9:42pm UTC](https://answers.netlify.com/t/pretty-urls-return-404-on-about-instead-of-301-to-about/135980 "2025-01-02T21:42:27Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![my-astro](https://sea1.discourse-cdn.com/netlify/user_avatar/answers.netlify.com/my-astro/32/66518_2.png) [@my-astro](https://answers.netlify.com/u/my-astro)\
**Post date:** [January 2, 2025, 9:42pm UTC](https://answers.netlify.com/t/pretty-urls-return-404-on-about-instead-of-301-to-about/135980/1 "2025-01-02T21:42:27Z")

</div>

Heya!

I was wondering if somebody can clarify `pretty_urls` for me.

I’ve expected 301-redirect from `/about` to `/about/`, but getting a 404 instead.

demo: [https://pretty404.netlify.app/about/](https://pretty404.netlify.app/about/)

Here is my [repo](https://github.com/my-astro/pretty404). I am on Astro, server side, using Netlify adapter and netlify.toml with pretty\_urls set to ‘true’. My trailingSlash set to ‘always’ and files’ format to ‘directory’.

Am I missing something and this part of the [Scott’s guide](https://answers.netlify.com/t/support-guide-how-can-i-alter-trailing-slash-behaviour-in-my-urls-will-enabling-pretty-urls-help/31191#p-86000-im-ssg-lessmy-ssg-uses-static-routing-4) is not applicable to my case?

Should I configure 301 myself? (I’ve read that [it is better to rely on pretty\_urls](https://docs.netlify.com/routing/redirects/redirect-options/#trailing-slash) to handle trailing slashes)

Stuff I’ve read before asking:

1. Docs
2. Forum
3. [[Support Guide] How can I alter trailing slash behaviour in my URLs? Will enabling Pretty URLs help?](https://answers.netlify.com/t/support-guide-how-can-i-alter-trailing-slash-behaviour-in-my-urls-will-enabling-pretty-urls-help/31191)
4. [Pretty URLs, URL Routing, and Trailing-Slashes](https://answers.netlify.com/t/pretty-urls-url-routing-and-trailing-slashes/29261)

---

<div class="post-metadata">

**Author:** ![nathanmartin](https://sea1.discourse-cdn.com/netlify/user_avatar/answers.netlify.com/nathanmartin/32/30845_2.png) [@nathanmartin](https://answers.netlify.com/u/nathanmartin)\
**Post date:** [January 3, 2025, 12:17am UTC](https://answers.netlify.com/t/pretty-urls-return-404-on-about-instead-of-301-to-about/135980/2 "2025-01-03T00:17:21Z")

</div>

@my-astro As I understand it the `pretty_urls` functionality is for standard static sites.

A file of `/about/index.html` results in `/about/`  
A file of `/about.html` results in `/about`

If using a more complex system like Astro, you would need to learn how Astro achieves what you want.

It’s highly likely your requests are handled by a function, and Netlify’s system isn’t even playing a part.

For example these definitely aren’t ‘static files’ for your site:  
[https://pretty404.netlify.app/about.html](https://pretty404.netlify.app/about.html)  
[https://pretty404.netlify.app/about/index.html](https://pretty404.netlify.app/about/index.html)

I can’t give you specifics as I don’t work with Astro, but you probably want to re-read something like:  
[https://docs.astro.build/en/guides/routing/](https://docs.astro.build/en/guides/routing/)

---

<div class="post-metadata">

**Author:** ![my-astro](https://sea1.discourse-cdn.com/netlify/user_avatar/answers.netlify.com/my-astro/32/66518_2.png) [@my-astro](https://answers.netlify.com/u/my-astro)\
**Post date:** [January 3, 2025, 7:18am UTC](https://answers.netlify.com/t/pretty-urls-return-404-on-about-instead-of-301-to-about/135980/3 "2025-01-03T07:18:58Z")

</div>

Hi there!  
Thank you for your reply!

So, Netlify does not [normalize URLs](https://docs.netlify.com/routing/redirects/redirect-options/#trailing-slash) of server side projects?

> [@nathanmartin](#):
>
> A file of `/about/index.html` results in `/about/`  
> A file of `/about.html` results in `/about`

My astro format configured as “directory”, meaning this `/about/index.html` outputs `/about/` page on build.

I am using folders structure to comply with Netlify’s general approach to trailing slashes. I also did not want to configure 301 redirects myself, since it will create infinite loops of redirects when Netlfy’s URL normalization will kick in. (According to the [Netlify’s Docs](https://docs.netlify.com/routing/redirects/redirect-options/#trailing-slash))

Could someone bring light to my issue, please:

- Does Netlify normalize URLs for server-side projects?
- Does `pretty_urls` configuration work for server-side websites?

---

<div class="post-metadata">

**Author:** ![nathanmartin](https://sea1.discourse-cdn.com/netlify/user_avatar/answers.netlify.com/nathanmartin/32/30845_2.png) [@nathanmartin](https://answers.netlify.com/u/nathanmartin)\
**Post date:** [January 3, 2025, 7:52am UTC](https://answers.netlify.com/t/pretty-urls-return-404-on-about-instead-of-301-to-about/135980/4 "2025-01-03T07:52:05Z")

</div>

@my-astro I can’t say for certain, as I don’t work with “server side projects” with Netlify.

You can wait for Netlify to answer, if you need to confirm more quickly you could check/test yourself.

**Step 1.**  
Confirm what files your build is producing.  
You can do this by running your build locally, or using the **Deploy File Browser** :  
[https://answers.netlify.com/t/new-feature-browse-files-in-your-deploy-with-the-deploy-file-browser/105196](https://answers.netlify.com/t/new-feature-browse-files-in-your-deploy-with-the-deploy-file-browser/105196)

Determine if you’re using “server side functionality” or only static files.

**Step 2A (Static Site)**  
If you are using only static files.  
Then it should be operating as per the Netlify documentation.

**Step 2B (‘Functions’ Based Site)**  
If you’re using “server side functionality”  
You could deploy a static minimum reproduction of the structure to see if it behaves differently.

If you haven’t seen it already, Netlify’s documentation for ‘Astro on Netlify’ is here:  
[https://docs.netlify.com/frameworks/astro/](https://docs.netlify.com/frameworks/astro/)

Depending on your project, you may also be dealing with the behavior of Astro’s ‘Netlify Adapter’:  
[https://docs.astro.build/en/guides/deploy/netlify/](https://docs.astro.build/en/guides/deploy/netlify/)  
[https://docs.astro.build/en/guides/integrations-guide/netlify/](https://docs.astro.build/en/guides/integrations-guide/netlify/)

---

<div class="post-metadata">

**Author:** ![my-astro](https://sea1.discourse-cdn.com/netlify/user_avatar/answers.netlify.com/my-astro/32/66518_2.png) [@my-astro](https://answers.netlify.com/u/my-astro)\
**Post date:** [January 3, 2025, 12:59pm UTC](https://answers.netlify.com/t/pretty-urls-return-404-on-about-instead-of-301-to-about/135980/5 "2025-01-03T12:59:41Z")

</div>

**Step 1 result**  
Deploy file browser contains 2 files:

- favicon.svg
- netlify.toml

**Step 2A (Static Site)**  
Deploy file browser contains 4 files:

- about/index.html
- favicon.svg
- index.html
- netlify.toml

demo: [https://prettystatic.netlify.app/about/](https://prettystatic.netlify.app/about/)  
repo: [GitHub - my-astro/prettystatic](https://github.com/my-astro/prettystatic)

I’ve tested `pretty_urls` on a static variant and it works as expected: both `/about.html` and `/about` redirect to `/about/`.

So now we know on practice, that pretty\_urls work on static websites and do not apply to Astro SSR (output: ‘server’). For people who will search for such topic – I first thought that this [thread](https://answers.netlify.com/t/pretty-urls-trailing-slash-not-working-correct/93997) is unrelated, but seems it is since Astro Netlify adapter is a function.

The thing I want to clarify is URLs normalization, I can’t wrap my head over it and if you have any ideas how can I test if normalization kicks in will be much appreciated!

---

<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:** [January 4, 2025, 1:36pm UTC](https://answers.netlify.com/t/pretty-urls-return-404-on-about-instead-of-301-to-about/135980/6 "2025-01-04T13:36:09Z")

</div>

Normalization does not apply to Functions as users would expect the URLs to be “as-is” so they can perform any required actions with the URLs themselves.
