I often find myself falling into a world in which I am not so sure about the URLs that I came up with. I think that’s mainly because I have a few questions regarding URL design in django that remain unanswered.
Say, I have built a public profile page for my site users. It can be accessed by providing an user id. Should the user id be part of the URL (ie. /profile/<userid>/) or should it be provided in the querystring (/profile?userid=<userid>)? And why?
I use AJAX extensively in my project. Should the AJAX URLs be designed differently from their counterparts? Is there a design pattern for this purpose?
There isn’t any hard-and-fast rule here. I’d say that anything which is reasonably static should use the
/profile/<userid>/format. GET parameters –?userid=<userid>– should be reserved for things that are more dynamic, are just difficult to encode as part of the URL (such as a set of search terms), or when you need several parameters at once and can’t count on the order.