PDA

View Full Version : URL's with spaces in variable values



chromate
10-16-2003, 11:29 AM
How do the search engines handle spaces in urls?

for example take the following URL:

http://www.domain.com/search.php?val=blue bottle

It actually comes out as:

http://www.domain.com/search.php?val=blue%20bottle

Now, I'm trying to use search engine friendly URLs. So, would the following be "search engine friendly"?

http://www.domain.com/search/blue%20bottle

Or does the space character (I guess the search engine would actually see a space and not %20?) matter?

chromate
10-16-2003, 11:30 AM
Just looking at my post, it seems like it will be a problem ;)

Mike
10-16-2003, 12:31 PM
I think there's an article on this somewhere...

I'll have a look.

chromate
10-16-2003, 12:36 PM
I've read the one about search engine friendly URL's on this site, which you may be thinking of. But I haven't seen anything about spaces in the URL. If you do find anything though, I'd appreciate it :)

Mike
10-16-2003, 12:39 PM
Hmmm...Can't find it. Sure I've read one though.

Anyway, from what I've heard it's bad for you to do that - and better to use dash or underscore.

I'm sure Chris will be able to confirm that, or say different though.

chromate
10-16-2003, 12:45 PM
Yeh, I'm pretty certain that it's not a good idea. Just wanted to make sure before I add the code to replace a space character with an underscore on one page and then have it taken away again on the resulting page. I'm trying to keep things as simple as possible :)

Chris
10-16-2003, 01:30 PM
URLs with urlencoded spaces work, but you're better off not using them.

chromate
10-16-2003, 01:35 PM
If I was to replace them, would it be better to use a hyphen or an undersocre?

Chris
10-16-2003, 04:04 PM
hyphen