User profile page canonical URL is not case normalized

AI-generated summary

A discussion was started by RGJ regarding the user profile page canonical URL not being case normalized. For example, https://meta.discourse.org/u/DiscObOt and https://meta.discourse.org/u/discobot both work, but the canonical URL is not normalized to the official case of the username. Sam suggests normalizing the username to lowercase and forcing a redirect for mis-cased usages, similar to how topic and category URLs are normalized. codinghorror agrees and suggests adding it to andrei’s list, who has added it with low priority. stance455 also agrees with cleaning this up and points out that different canonical URLs are used for each variation. Additionally, stance455 notes that tag URLs also exhibit similar behavior and suggests normalizing them to lowercase.

It seems like URL’s to user profiles are not case sensitive.
For instance https://meta.discourse.org/u/DiscObOt works just as well as https://meta.discourse.org/u/discobot

But the canonical URL in the first variation is not canonicalized into the ‘official’ case of the username, possibly leading to duplicate content issues or the wrong variation being indexed.

So the canonical URL of the first variation is:

<link rel="canonical" href="https://meta.discourse.org/u/DiscObOt" />

while it should be

<link rel="canonical" href="https://meta.discourse.org/u/discobot" />

leading to the ‘correctly’ spelled variant.

6 Likes

Hmm is this an issue in practice?

1 Like

I don’t think it is … but it is kind of odd that we allow:

https://meta.discourse.org/u/codinghorror

https://meta.discourse.org/u/codinghorrOr

https://meta.discourse.org/u/cOdinghorror

We should normalize the username to lowercase username and force a redirect for the various obscure mis-cased usages similar to how we normalize topic urls / category urls.

I guess the same normalization should hold for https://meta.discourse.org/g/Admins

We already perform normalization using a redirect for https://meta.discourse.org/c/Bug/1/l/unread and https://meta.discourse.org/t/incorrect-canonical-url-for-user-profile-PAGE/190847

Low priority but we should clean this up.

Changing this to Contribute > Feature though cause nothing is really broken, it is just odd and inconsistent.

4 Likes

Sure perhaps @andrei could add to his list? this one seems easy and high reward for low risk?

2 Likes

I’m adding this to my list with low priority.

3 Likes

I’m also for cleaning this up..

You’ll also notice that each of those urls has a different canonical pointing to itself. (@RGJ already mentioned this)

Correct, I imagine it should be the same for the user urls, or at the very least have all those urls share the same canonical.

I’d also like to add that tag urls also exhibit similar behavior.

In that, the tag urls are not “case normalized” (if thats the proper terminology).

So both

https://meta.discourse.org/tag/Official

and

https://meta.discourse.org/tag/official

go to the same place but have self referencing canonicals instead of just the lower-case version.

1 Like