Short URL conflicts. Prefer an item or a list of items?
I am building a site with tutorials and other stuff. I am trying to find a good url structure. However, I have a conflict:
tutorials/ <-- list of all tutorials
tutorials/a-very-cool-tutorial <-- points to the very cool tutorial
tutorials/java <-- a list of tutorials tagged java
tutorials/java+soap <-- a list of tutorials tagged java and soap
tools/soap <-- soap tools
tools/wsdl-generator <-- points to the tool
resources/foo <-- resources for a foo
resources/foo+bar <!-- resource for a foo and a bar
tutorials/java?sort=newest
tutorials/php?showhidden=yes&count=30
There is no way to automatically resolve the difference, so one of them must be changed. Which one should i do
tutorials/show/a-very-cool-tutorial
VS
tutorials/list/java
or list-of-tutorials or something like that?
I tend to go with tutorials / list / (and redirect tutorials / to this too)
a source to share
What's wrong with that?
tutorials/ <-- list of all tutorials
tutorials/a-very-cool-tutorial <-- points to the very cool tutorial
tutorials/tags/java <-- a list of tutorials tagged java
tutorials/tags/java+soap <-- a list of tutorials tagged java and soap
Seems much more intuitive to me and avoids any ambiguity.
a source to share
Why don't you express your article hierarchy in a URL structure? You can write:
tutorials/ ← list of all tutorials
tutorials/java ← a list of java tutorials
tutorials/java/a-very-cool-tutorial ← points to the very cool tutorial
So the visitor can say that a very cool tutorial is a Java tutorial, and if you don't mind SEO, this version is good for that too.
Edit
As per your comment, an article may contain multiple tags, and your site has lists of articles belonging to a set of tags. In this case, you can choose this concept:
tutorials/ tutorials/a-very-cool-tutorial tags/java ← tags have a separate prefix tags/java+soap
Or another:
tutorials/
tutorials/a-very-cool-tutorial.html
tutorials/java/
tutorials/java+soap/ ← the trailing slash indicates that it a listing
(And you can write a third one, which may be better or not.) It's a matter of your taste.
In addition to your chosen scheme, I suggest that you include the article ID or publication date in the URL to avoid colliding with the URL.
tutorials/20090509/a-very-cool-tutorial ← a visitor friendly way
tutorials/928/a-very-cool-tutorial ← ID in URL like how Qaru does
Edit 2
Your last update on the question found that apart from tags you have something like categories - I mean tutorials, tools, resources. This creates unnecessary complexity in the problem. I think it would be better to handle these additional aspects as tags. So the tutorial is just another tag like java and this works with all the ideas above.
/a-very-cool-tutorial ← article (beware of URL collision)
/java/ ← all Java posts
/tutorials+java+soap/ ← all Java related SOAP tutorials
/tags/tutorials+soap/ ← you can use an extra prefix
a source to share
Why not
tutorials/ <-- all tutorials
tutorials/java <-- all Java tutorials
tutorial/a-very-cool-tutorial <-- the very cool tutorial
thus distinguishing between individual tutorials and lists of tutorials using the singular / plural. This removes any possibility of ambiguity that might give you some sense of security :-)
a source to share
It is not "impossible". You can always have a method to check if the last item in a path is a group or item and act accordingly - passing control to the appropriate code. I have used this technique before on a shopping site.
Since the number of items is usually more than the number of groups, I would suggest checking if you are dealing with a group as a special case and return to an item by default.
Not to say that having an extra parameter in the url is wrong, better or worse. But you can do it the way you originally stated.
a source to share
tutorials/by-tag/java
tutorials/search/user-search-string
tutorials/ <-- all
tutorials/a-nice-tutorial
When parsing a URL, you can search for these keywords. If unknown, then the variable index goes to the parent "resource" for resolution (the tutorial collection gets "/ a-nice-tut", the search object is passed to searchstring, etc.).