Never Put Underscores in Subdomains!

Never Put Underscores in Subdomains!

So I found its very rare to find posts on this particular topic. So I am writing up a short post on the subject. Simply put, Do not put an underscore in your subdomain.

Example: http://some_name.example.com

The reason for this?

Internet explorer does not like this particular character in the domain. Something to do with how it stores cookies and handles sessions, I am not familiar with how it handles this particular task so I cannot tell you why the session gets deleted. My best guess is it parses the subdomain and tries to scrub the underscore from it.

Internet explorer will display content just fine and for the most part the underscore will not be an issue, until your users try to login. Chrome and Firefox appear to handle the underscore just fine. Internet explorer does not, the underscore will cause you to lose cookies and as a result your session making it impossible for your users to login at least on internet explorer.

After racking my brain for why the session would not stick but would stick in every other browser, and cursing Internet Explorer several times. I came to this conclusion, Never ever use a underscore in the subdomain unless you like the idea of trying to solve a riddle, wrapped in a mystery, inside an enigma.

The final results was using a subdomain like this –

Example: http://some-name.example.com
Another Option: http://somename.example.com

Hope this helps some of you out and perhaps prevent you from having to agonize over this issue.