Pretty URLs does not remove .html

works nicely, but not when entering complete URLs like subdomain.netlify.app/folder/file.html
to my understanding, the new URL should be subdomain.netlify.app/folder/file, right?

can you reproduce this behaviour?

Yes, I believe that’s what it should be. Please share a site to check.

I created a very basic test site.

What does not work: .html not removed

https://pretty-urls.netlify.app/index.html
https://pretty-urls.netlify.app/file.html
https://pretty-urls.netlify.app/folder/index.html
https://pretty-urls.netlify.app/folder/file.html

Other rewrites work:

https://pretty-urls.netlify.app/index
https://pretty-urls.netlify.app/folder
https://pretty-urls.netlify.app/folder/file/

Thanks in advance for checking the corresponding code!

I think currently it’s only supposed to change the links for that. For example, if you add a link in your HTML like:

<a href="/file.html">

we would automatically change that to

<a href="/file">

Thus, a user would technically be navigating directly to /file (and not /file.html, unless they manually enter that path).

Yes, but as all other rewrite rules work for entered URLs, .html should also be removed for URLs entered, not only links on the page.
There should only be one display version of the same URL, not two.

Maybe, it would even be better, not to mess with the links and only implement the following rewrite rules:

  • *.html to :splat
  • /index to /
  • /:folder to /:folder/
  • /:file/ to /:file

By the way: .htm is currently removed - just .html not …

Thanks for the suggestion! Our dev team has said they won’t be changing the way this feature works, though, so I suppose you’ll want to work around it in whatever way is most appropriate for your situation.

Keeping the link rewrites is okay for me.

But I do not see the logic behind the rewrites for entered URLs. Everything works the same way as the link rewrites, except for .html not being removed. That does not make sense to me.

And I cannot do it myself, right?
/*.html /:splat
is not valid according to the docs.

So, I would really appreciate if Netlify could implement the missing .html removal when rewriting URLs (with pretty URLs on).

Thanks in advance!