To allow or not to allow spaces in URLs?

First of all, I hope this thread is ok in this forum, otherwise, please could a moderator move it to a more suitable location, sorry.

Right, I know it’s been told and told again Don’t put spaces in URLs. Something that I have always stuck to very strictly.

My question is why? And does that rule still apply today?

I know it used to be because some older browsers used to not work properly if there were spaces and I also know that different browsers handle spaces slightly differently.

In 2011, is it still a rule that should be followed? I’m not looking to change the way I code but I’m just curious and I would like to be able to give a better answer that “it’s just so” when someone asks me the question. :slight_smile:

Spaces are converted to %20 in a URL.

They look ugly and various problems can arise from using them (problems converting back and forth between the space and the %20 symbol). Different browsers and applications can handle it in different ways.

Typically, a dash is used in place of a space these days.

It’s much cleaner, easier to read, and doesn’t run into symbol conversion issues.

Thank you Force Flow for your comments :slight_smile:

Anyone else have an opinion?

The current de facto standard is to use dashes.

Using spaces will mean your pages will not display in browsers that do not accept spaces as valid (which browsers are not required to accept as space is not in the list of characters that is allowed in file names on some operating systems).

Thank you felgall for your feedback.

I’m pleased to hear that so far the opinion is that spaces should NOT be used in URLs, EVER! :stuck_out_tongue:

It is as I said in my original post something that I have always stuck to. But then I came across a web development company using spaces and I wanted to try to understand if they were professionally wrong or if I was a stuck-in-the-mud and in need of an update :smiley:

Thanks to you both for your feedback, and of course if anyone else still wants to give an opinion, I’d gladly hear it too :slight_smile:

I would wonder how long that company has been around, or will be around if they’re doing that. One point to add is that spaces in internal links, say a PDF, also cause headaches. Someone trying to save a PDF named my%20bad%20pdf.pdf will get confused quickly. Using underscore or camel case, myGoodPdf.pdf, makes much more sense.

@vmtech yep, I totally agree with all your points.