Best practices for domain names, urls, etc
What characters can be use in domain names and urls? This is one of those topics that's really surprised me when people have asked me about it! As a web dev nerd it all seems pretty obvious, or like something we don't think about at all, but then you realize that non-nerds have never had to know or think about these things. It's great that people ask, and there are a bunch of dos and don'ts to be aware of...
Domain names
Domain names can contain letters, numbers, and hyphens. No other characters are allowed — like, don't try putting an underscore in your domain name. You can make up any string of characters you want with letters, numbers, and hyphens, and then you get the ".com" at the end.
It's important to note, domains are not case-sensitive, but in a web browser, no matter what case is used, they become all-lowercase automatically. What that means is, it's okay to display capital letters in domain names wherever you want, e.g. BrandCopayCard.com. This can be useful for making the domain look nicer and be more readable. But when the user enters BrandCopayCard.com in their browser, it will automatically convert to brandcopaycard.com when they land on the site.
Try it: type Google.com (capital G) into your browser's address bar — or even GOOGLE.COM, or GoOgLe.CoM — and hit enter; they all resolve to google.com when you land on the site.
As I'm sure you've already figured out, some companies like to display their name with some capital letters to make it seem cooler, or more readable, more branded-looking, etc. That's all fine, in both print and digital pieces.
Urls
So, domains are not case-sensitive, however, everything after the .com/ is!
This is important. If the full url for a page is brand.com/efficacy, we cannot display it as Brand.com/Efficacy. If the user types that in, the capital E may cause an error. The capital "B" will resolve to lowercase just fine; the capital "E" will not.
So when we're writing urls, either for SEO purposes, or just for the basic UX purpose of displaying something clear and semantic in the user's address bar, make sure to follow those rules for case sensitivity.
The best practice rule of thumb is to keep domains, and the stuff after the domain, all lowercase.
Remember how I said domain names can contain contain letters, numbers, and hyphens? Well, for everything after the .com and the slash, you can use those, and you can also use underscores — e.g. brand.com/copay_card
But that's it; no other characters — no question marks, no registered symbols, no quotes, no apostrophes, etc etc.
Hyphen or underscore?
There's a long running (and very low stakes) debate about whether hyphens or underscores are better in urls. A long time ago, Google revealed that hyphens between words were better than underscores. The reason was that their bots would read a hyphen as a space, but they'd read an underscore as nothing at all — this means that copay-card (with a hyphen) would be read by Google as copay card, but copay_card (with an underscore) would be read by Google as copaycard; not a real word, so, not as advantageous for SEO.
That was many years ago, and while I can't prove it, I'm convinced this is no longer the case, so both hyphens and underscores should be fine from an SEO perspective. So the question is really, what looks better? Does it matter?
I prefer hyphens, for whatever it's worth, for one very simple reason: We can use hyphens in both domain names and full urls. We can't use underscores in domain names. So I think it's generally a bit neater, a bit simpler, to use hyphens for everything.
By the way, do not use spaces in your urls. For example, if you tell the devs they have to make the url for a page brand.com/safety data, they can do this, but it will resolve in-browser as brand.com/safety%20data. The space becomes "%20"; it's ugly, and it just looks kind of janky, maybe even untrustworthy or unprofessional.
Do we need to include www.?
These days this is almost always optional, but you'd better do a test with your site to be sure. Type in your website with "www." and the domain name and hit enter, and they try again without the "www." and hit enter. Did they both resolve to your site? Probably. So, if they do, then you have the choice to include the "www." or not when you're displaying your domain anywhere, or saying it out loud, etc etc. These days most brands just omit it; personally I think it's a little old-fashioned.
Vanity domains?
By the way, what's a vanity domain? A vanity domain is just a domain name that's purchased by a brand that's separate from their main brand.com, and usually used for promotional purposes. I'll make up an example: the main brand domain is lorem.com, and the Lorem brand wants to run a print campaign that directs people to a website where they can win a contest, so let's say the Lorem company buys the domain winbigwithlorem.com.
What can the brand do with this vanity domain? They could point it to the contest page on their website. Or they can create a whole new website for the contest, and point this new domain there. They can also track visits to this domain. For example, let's say winbigwithlorem.com points to a contest page within lorem.com, and let's say winbigwithlorem.com is only ever displayed in a print campaign, out in the world. When the client looks at how many users visited the contest page, they'll be able to see specifically how many got there because they typed in the vanity domain (meaning they saw it in the print campaign), and they'll know that the rest of the visits to that page were organic — either they were on the main brand site and navigated to this interior page for the contest, or maybe they arrived at the contest page directly from Google. So, vanity domains can be really interesting from an analytics perspective.
Another benefit to vanity domains is that they're just easier to remember. A print or radio ad could say, "Visit winbigwithlorem.com" rather than spelling out a whole long url to an interior page of the brand site, with slashes and everything.
Bonus: email addresses
Much like domain names, email addresses are also not case sensitive; for example:
manning@manningkrull.com – Manning@ManningKrull.com – MANNING@MANNINGKRULL.COM
These are all the same thing; type in any of them and they'll all go to the same place. So you can display your own email address (in a sig file or whatever) using any case you want — like for the purposes of making it clear or memorable, or just because you have a personal preference for displaying your name a certain way — and people will be able to use it. You can easily test all this stuff! Send yourself some emails!
As for characters in an email address, for everything before the @ sign you can use letters, numbers, hyphens, and underscores — basically the same stuff as in urls — and you can also use periods.
– Manning
Questions/comments? Feel free to contact me at manning@manningkrull.com. I update these articles pretty frequently — best practices evolve over time as the world of digital quickly changes, and I always welcome insights from others.