Changes between Version 1 and Version 2 of Ticket #36483
- Timestamp:
- Jun 27, 2025, 1:48:58 PM (2 months ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
Ticket #36483 – Description
v1 v2 5 5 That was a cool accidental feature to discover, however now I'm concerned about URL canonicalization. Python 3.13.3 accepts _68_ different characters for each digit. This means the same content is hypothetically accessible from many, many URLs. I've heard that can make a site look spammy to search engines. And maybe this could be an element of a security hole if something is assuming there is only one URL for a given page. 6 6 7 The SEO problem could be addressed by setting a `<link rel=canonical>` in the page to point to `Pizza.objects.get(pk=id).get_absolute_url()` or some similar logic, or you could address the problem as a whole by setting up redirects or 404 responses, but all those approaches require a separate implementation for every view, since the view code ultimately doesn't know which parts of the URL are going to be treated as values of a `IntegerField`.7 The SEO problem could be addressed by setting a `<link rel=canonical>` in the page to point to `Pizza.objects.get(pk=id).get_absolute_url()` or some similar logic, or you could address the problem as a whole by setting up redirects or 404 responses, but all those approaches require a separate implementation for every view, since Django's code ultimately doesn't know which parts of the URL are going to be treated as values of a `IntegerField`. (Django's `DetailView` could implement some logic for this, however in reality there are lots of other situations where people take a string from the URL use it to look up a record with an `IntegerField`.) 8 8 9 9 Possible solutions I can think of are either: