This isn’t going to come as news to any web developer who thinks about it for more than a second. But ask yourself - how many URL fields are there in your applications’ databases that are defined as VARCHAR(255) or similar?
Long URLs are a nuisance. They’re generally unnecessary, always ugly and often cause presentation problems. That’s why God gave us TinyURL. (It’s got an API, too.)
Things were going well for short, clean and simple URLs until the current mania for search engine optimisation demanded that URLs should be another place to engage in keyword stuffing. Ugh. If it takes more than 255 characters to uniquely identify your resource, you’re probably committing a crime against good design somewhere.
Apparently, the HTTP specification places no specific limit on the length of URLs, which means even a MySQL TEXT column that can take 64K characters could theoretically be inadequate. But the line has to be drawn somewhere, so users of my sites take note - if you want URLs longer than 64K characters you’re on your own.
(If you’re running MySQL 5.0.3 or later you can declare a VARCHAR up to 65,535 characters.)
0 Responses to “Some URLs are longer than 255 characters”