Forum Moderators: Robert Charlton & goodroi

Message Too Old, No Replies

%20 in existing urls

         

DiscoStu

7:51 pm on Jan 17, 2012 (gmt 0)

10+ Year Member



Had a news section built out by a third party a few months ago. I know dashes are preferred, but all current urls use %20 (i.e. space encoding) in urls. I'm trying to find any official word on how spaces are handled by google but can only find Matt Cutts saying hyphens are preferred over dashes. Is there any official support for spaces in urls having negative effect?

We could change the urls, but it would require a lot of rewrites and recoding, so I'm looking for some proof that it's worth it. Does anyone know of an official or semiofficial source that discusss the problems of spaces in urls?

Thanks

g1smd

8:47 pm on Jan 17, 2012 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



In the long term change the spaces to hyphens.

URLs with %20 in are completely unreadable.

As for the redirects, you can do it in a few lines of code. Rewrite (that's rewrite, not redirect) requests with spaces to a special PHP script using a RewriteRule near the start of your directives. In the PHP script test the requested URL, build the new URL by replacing spaces with hyphens, then send that as a 301 redirect using the PHP HEADER directive.

DiscoStu

12:28 am on Jan 18, 2012 (gmt 0)

10+ Year Member



> URLs with %20 in are completely unreadable.

So are you saying Google can't read %20 urls? I actually saw a comment from you from a few years back on Matt Cutt's blog, saying you avoided it but I have yet to find any concrete reason why it should be avoided. I know it's bad, but I work inhouse and have to give a reason why the developers should change the whole URL structure and I'm being met with some skepticism. Just trying to find an official source somewhere, like hyphens being preferred over underscores

g1smd

12:42 am on Jan 18, 2012 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



Human unreadable and verbally uncommunicable.

Your sales guy to customer over the phone: "w w w dot example dot com slash discounted percent twenty sale percent twenty items".

Customer: confused beyond belief.

What do you prefer?

www.example.com/discounted%20sale%20items
www.example.com/discounted-sale-items


Avoid underscores too. They are not fully treated as word separators.

Your developers need to read the HTTP specifications again. They clearly define the characters allowed in domain names, in paths and in query strings. Each have different requirements and exclusions.

DiscoStu

1:09 am on Jan 18, 2012 (gmt 0)

10+ Year Member



Well I guess that was my question - are there any drawbacks aside from the URLs being ugly/difficult to communicate. But it sounds like the answer is no? There are no strictly technical drawbacks to having %20 in the url (in terms of indexation/crawling etc)?

tedster

3:20 am on Jan 18, 2012 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Right - but there is a very real secondary effect from having an "unattractive" URL display in the SERPs. Not enough clicks might even mean you lose a few position.

lucy24

4:38 am on Jan 18, 2012 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



There's a third risk. If you take something containing literal spaces and paste it directly into the browser's address bar, some browsers will silently remove the spaces. Do you have a nice 404 page? You'll need it.

leadegroot

12:31 pm on Jan 18, 2012 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I have a few pages which have %20 in the urls (poor planning - didn't consider that some of the elements making up the path had spaces. Ooops) and it is a problem - I see truncated urls, where some agent has chopped it at the %20; I see the occasional agent which doesn't seem to convert well between ' ' and %20, leading to 404s and so on. Its a very small number of errors, but it does happen.

(Yes, yes, I'll fix it one day, but its such a small number of pages that I haven't gotten around to it)

enigma1

12:45 pm on Jan 18, 2012 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



are there any drawbacks aside from the URLs being ugly/difficult to communicate

There are with encoding/decoding. Using the links with forms requires a different encoding, some old browsers allow unencoded spaces and you may transition to a different framework in the future where the url encoding maybe problematic. In this later case you would have to start redirecting or use different links which will impact your page rank. Using hyphens instead of character encoding is more efficient and reduces link management.