URLs

URLs are a relatively minimal factor in terms of SEO at this point, but there are a few things that are important to consider. As with many other ranking factors, adhering to SEO recommendations also provides a good user experience. The following attributes have to be kept in mind when creating new URLs.

URL length

There is no magic number of characters a URL should contain. The goal is simply to make the URL as short and clean as possible. This means eliminating subdirectories where possible and staying close to the root of the domain.

For example, www.clothing-store.com carries a women's quarter-zip fleece pullover. They would have a few fairly search-friendly options, like:

http://www.clothing-store.com/women/tops/shirts/athletic/fleece/womens-quarter-zip-fleece-pullover/

or

http://www.clothing-store.com/womens-quarter-zip-fleece-pullover/

The second URL is preferable because the product is listed directly off the domain; it's shorter and more compact because subdirectories have been eliminated.

Use of keywords

Users like URLs with keywords. A URL that contains an article title or a product name gives an indication of that page's content.
In addition to the benefit to users, a keyword-rich URL contributes to the overall relevance of a page on a search engine standpoint.

Recommended URL

http://www.clothing-store.com/womens-quarter-zip-fleece-pullover/

Not recommended URL

http://www.clothing-store.com/p_id_83jflsue8jl38f

Use of parameters

Where possible, using parameters should be avoided. They are messier for a search engine to process and less friendly for users to read. They also tend to make a URL long and sometimes unruly. Tracking parameters may contribute to duplication, which is a separate issue.

Lowercase vs. uppercase and trailing slashes

Using a single version of a URL, whether upper- or lowercase, is preferable. This is specifically to make efficient use of the crawl and avoid duplication. There isn't an inherent benefit in using only lowercase characters.
If lowercase is chosen, the uppercase version would ideally 301 redirect to the lowercase, or vice versa, resulting in a single version of the end-state URL.

The same concept applies for a URL with an ending trailing slash or the same URL without the trailing slash. One structure should be picked and remain consistent.

Use of special characters

Certain characters behave differently in URLs. Some characters indicate special things to search engines, like a hash or a question mark. Consequently, they need to be used in accordance with their specific purposes.

Hash ("#")

The "hash" or "pound" symbol indicates the presence of an hash fragment (string of characters after the #).

There are two main situations where the hash symbol is used

Note that search engines bots do not access the full URL when hash fragments are used. For example, if the URL is http://www.domain.com/category.html#subcategory, crawlers will only see and request http://www.domain.com/category.html.

This doesn't present any issue when the hash fragment simply takes the user to a specific section of the page. However, if hash fragments are in use for AJAX implementation and the content on the page changes, search engines will only access the content initially loaded with the page.

Question mark ("?")

Question marks are commonly used to indicate the subsequent presence of a parameter.

Example

http://www.clothing-store.com/womens-quarter-zip-fleece-pullover?referrer=twitter

That "?referrer=twitter" part at the end indicates there was a tracking parameter added to the link to show where the visitor came from.

Equal sign ("=")

An equal sign commonly separates two components of an "attribute-value pair" (AVP) parameter, such as color=green.

Underscore ("_")

The underscore causes all words in a string to be read as a single term by search engines, rather than as separated like our eyes would read them. When the string is "womens_blue_shirt", the search engine sees "womens_blue_shirt" and not "womens blue shirt". The relevancy of keywords is then lost. Separating using dashes ("-") eliminates this (example: "women-blue-shirt").

Space (" ")

URLs can't contain spaces. A URL that does contain spaces, perhaps generated by a CMS that's not configured to properly handle spaces that exist in a product name, will have spaces replaced in the URL by either a "+" or "%20", which is the HTML encoding for a space.

Other characters

If a URL uses characters that fall outside the ASCII character set, they'll be encoded in a valid ASCII format by the browser before the URL is sent to the server. For simplicity, it's best if URLs contain letters, numbers, dashes and special characters like a question mark where specifically needed and do not contain other characters.

TL;DR

The ideal URL, from an SEO perspective, meets the following list of criteria:


Unless existing URLs are especially egregious, it's probably not worth rewriting all URLs and 301 redirecting the entire site just to clean up the URL structure. These are recommendations to consider when redesigning a site and when there is the opportunity to create the best possible URLs from scratch or to implement these practices going forward. The vast majority of the time, URL structure alone isn't a big enough ranking factor or problem for a site that it merits a change on its own.