Welcome to WebmasterWorld Guest from 174.129.96.175

Forum Moderators: Ocean10000 & incrediBILL & phranque

Are there illegal charaters for urls?

   
10:03 pm on Sep 7, 2007 (gmt 0)

5+ Year Member



I know this isnt 2001, but isnt it generally good practices to get pass through variables out of the url? Less important that it was?

Are there still characters you should not have in your url?

ie + or -

http://www.example.com/listing-My+Listing-10.html

Thank you

KieranMullen

[edited by: encyclo at 11:42 pm (utc) on Sep. 7, 2007]
[edit reason] switched to example.com [/edit]

10:16 pm on Sep 7, 2007 (gmt 0)

WebmasterWorld Senior Member jdmorgan is a WebmasterWorld Top Contributor of All Time 10+ Year Member



Yes, the use of many characters is prohibited, and what is allowed varies depending upon the part of the URI. See RFC 2396 - Uniform Resource Identifiers (URI): Generic Syntax [faqs.org]

The "unreserved" characters are generally "safe" to use:

2.3. Unreserved Characters

Data characters that are allowed in a URI but do not have a reserved
purpose are called unreserved. These include upper and lower case
letters, decimal digits, and a limited set of punctuation marks and
symbols.

unreserved = alphanum mark

mark = "-" "_" "." "!" "~" "*" "'" "(" ")"

Unreserved characters can be escaped without changing the semantics
of the URI, but this should not be done unless the URI is being used
in a context that does not allow the unescaped character to appear.


For details, see the cited document.

[added] Use of other characters is not "illegal" per se, but the client and the server will send them as escaped hex-encoded entities. For example, a space is sent as "%20" -- which looks awful in the browser address bar, is very difficult to remember and to type, and should therefore be avoided. [/added]

Jim

[edited by: jdMorgan at 10:19 pm (utc) on Sep. 7, 2007]

10:32 pm on Sep 7, 2007 (gmt 0)

5+ Year Member



Thank you for your response.

IOW after reading what you sent to me + is reserved and should NOT be used.

Correct?

thanks

11:26 pm on Sep 7, 2007 (gmt 0)

WebmasterWorld Senior Member jdmorgan is a WebmasterWorld Top Contributor of All Time 10+ Year Member



Here's an example URL with an attached query string:

http://example.com/my_script.php?query-string

If a "+" is included in the URL, it will be encoded as "%2b". This encoded character will appear in the browser address bar and in search engine listings.

If a "+" is included in the query-string, it will pass through unchanged.

As an experiment, try making a test page with links including these characters to see how they behave.

Jim

9:33 pm on Sep 9, 2007 (gmt 0)

WebmasterWorld Senior Member g1smd is a WebmasterWorld Top Contributor of All Time 10+ Year Member Top Contributors Of The Month



Always avoid spaces and underscores in URLs.

Hyphens are good for word spacers, but I usually use dots instead.

 

Featured Threads

My Threads

Hot Threads This Week

Hot Threads This Month