I know that Netlify treats all filenames as lowercase to avoid issues with case sensitivity. But I’d like to display a part of my URLs in uppercase, strictly as a presentational choice, for readability. Here’s an example URL:
https://lofty-staging.netlify.app/1lm6vm/
That six character string represents a human-readable ID that a user might want to write down or mention over a phone call, etc. But that lowercase L makes it very ambiguous, because at a glance it could be an uppercase I. I want to display it as /1LM6VM/ and have /1lm6vm/ redirect to the uppercase version. I tried setting up a redirect rule but it didn’t work. Is this at all possible?
I wasn’t aware that Netlify was case-sensitive, or treated all filenames as lowercase. When I uppercase your URL it seems to load the same page as the lowercase version, so why not just use uppercase in the link? Alternately, you could display the page name / path / whatever on the page itself in uppercase for visitors, so they don’t have to deal with the URL bar in the browser.
Yeah, it automatically redirects to the lowercase version, so uppercase links will work (I was already counting on that). But I still find it inelegant to display it in lowercase anywhere. If uppercase in URLs really isn’t possible with Netlify, I’ll be seriously considering changing the ID format to avoid ambiguity in lowercase, or maybe even going with numbers only. But that would be a real pain at this point
To be clear, I don’t think that Netlify should support strict case sensitivity in URLs. But it should respect the original file’s case and display it as the canonical URL, with other case variants redirecting to that instead of always defaulting to lowercase. Basically, Wikipedia-style URL rules.
Oh, I see what you mean. What’s happening there is, because the site is password-protected, you’re being asked for authentication before the redirect occurs. Once auth is confirmed you get redirected to the lowercase URL. The site will eventually be public and won’t use Netlify’s password protection feature, so every visitor will be redirected immediately.
We normalize URLs so you don’t get an SEO penalty for having the same content at two different paths, but I understand this is getting in the way of what you want to do in this case.
A weird thing you could try is putting a redirect in the mix, as I’m not sure we normalize redirected-to paths. This would mean your site structure would be something like this:
# project root
1lm6vm
/id/
|- 1LM6VM.html
and you could have a redirect rule like:
/1lm6vm /id/1LM6VM 301!
If this works, you would have to create a redirect rule for each ID… so definitely not ideal, but worth a try if the uppercase piece is really critical.
Thanks for clearing this up, @jen — sorry I missed it when you posted it.
Looks like trying to force uppercase is not worth the effort, so for this project I’ll be switching my ID schema to numbers only.
Still, I think Netlify should respect the original file’s letter case and use that as the “canonical” version that everything gets normalized to. If feels to me like a big oversight that Wikipedia-style URLs aren’t easily achievable. If there’s a specific channel for submitting this as a feature request, please let me know.
sorry we couldn’t be more helpful in the moment, but i have passed your insights on to our team. if we end up implementing something like this, i’d be happy to let you know!
Hi Jen, the redirect solution doesn’t seem to be working for me. I have /ontology/dark /ontology/Dark 301!
in my _redirects file, but when I try going to either I get a “redirected you too many times” error.
The capitalisation is a dealbreaker for me in this case unfortunately, I’d need to take the site elsewhere if I can’t keep uppercase links (public semantic web ontologies are case sensitive, since lowercase is used for properties and capital case for classes, see e.g. https://schema.org/Person (a page) and https://schema.org/person (404)).
Any ideas? I don’t have many pages, so I don’t mind mucking with the redirects file if needs be.
Hi @coelmay , got it, I guess I assumed it wouldn’t redirect from ontology/Dark to ontology/dark once it had already been redirected once. But
/dark /ontology/Dark 301!
doesn’t work either, it just goes to /ontology/dark anyway (although this also doesn’t suit my purpose, I need to be able to give someone the url /ontology/Dark, and have them go to that exact url in their browser. But I understand now this is a limitation of Netlify.