31

Why is it preferable to use paths with slashes instead of query-string variables in a web page URL?

5 Answers 5

8

One reason for having this as a goal during initial development is that it forces you to think critically about your web site's link structure from the outset. If the hierarchy is clear in the URL, then this clarity will naturally flow into the structure of the website and ease navigation for both your users and the search engines.

Depending on how you are developing your site, thinking about URL structure from the beginning may also help you with code design; what controllers you will need, how you are going to perform routing, etc.

Other reasons, such as URL readability and hackability have been touched on in other answers.

All of the search engines are doing a pretty good job with query string parameters these days, but if you're starting a new site, it is definitely worth using clean URLs.

1
  • Considering URL structure early on in a project is important. For that reason, I'm selecting this one as best answer. Aug 27, 2010 at 19:26
6

One of the primary reasons is for end-user readability. A slashed/re-written url is significantly easier to read and type than a long string of queries attached onto the end of a base url

3

Some people claim that it has a positive SEO effect. By including keywords that people will search for within the URL, your search engine rankings can be higher.

Other reasons include a neat URL structure and URL "guessability" through removal of URL path components to get to higher levels of navigation.

If you are using an MVC framework of any kind, you are more-or-less made to work in this way by picking controller names etc. to be friendly to the URL routing.

3

You mean: example.com/Teams/Arsenal instead of example.com?team=arsenal

Will other than the fact they will be implemented differently the former is both cleaner and also hackable. So if you remove 'Arsenal' it could display a list of teams.

1

The main reason I do it is for readability, specifically on search results. I've only heard this and don't have any hard numbers, but it's supposed to increase click through. In other words if you have 2 results with the exact same ranking, people are more likely to click on the clean and easy to read one. I don't think this always needs to be one with slashes, but I think this is easier than a query string.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.