Check out our Angular Book Series.

Can I use an Underscore in a URL?

Can you use an underscore in a domain name? The short answer is no. The longer is maybe, but don't do it.

I'm working on a project, and I'm the first Windows user on the team. They set up there local dev domains to point to sites:


site.com_local

I set it up using a hosts file on my Windows unit. I was able to ping that domain without issues and was able to telnet to the port. But, the web browsers wouldn't load the URL. This was confusing.

I resolved all the site load issues by changing the URL from

site.com_local
to
site.com.local
.

To make things extra odd, I can't replicate this on my own personal machine. Sites with URLs seem to load perfectly, so I'm wondering if the issue is with Tomcat--not Apache Web Server--or Docker which I'm not using on my own machine.

There is a great write up on this here. The general gist is don't use the underscore in URLs host names, or Fully Qualfiied Domain Names, but they might be okay in other types of DNS lookups.

Comments (Comment Moderation is enabled. Your comment will not appear until approved.)
All Content Copyright 2005, 2006, 2007, 2008, 2009 Jeffry Houser. May not be reused without permission
BlogCFC was created by Raymond Camden. This blog is running version 5.9.2.002.