I am developing a web app which displays sales from local stores around the United States. The sales and stores listed vary by location. Is there a RESTful URL scheme for describing this information while avoiding duplicate content?
Specifically, the app needs to list local stores, and list items sold at a particular store. Zip (postal) codes seem a convenient way to refer to location, so consider this scheme:
/stores/zip - list stores near zip, with links to particular stores /store/name/lat+long - list items at a particular store
There is a problem. The page at /store/name/lat+long
needs to link back to the list of stores, but which zip code should it choose? Say it chooses the zip code closest to the lat+long coordinate. A user might arrive at a particular store page from a link on /stores/zipA
yet the store page could refer them back to a slightly different list, /stores/zipB
.
We could solve that problem by carrying the zip code information forward. So the list at /stores/zip
, could link to /store/name/lat+long/zip
. This is not logical, however, because all information needed to identify a store is provided by the lat+long coordinate; the zip code is redundant. In fact the same page content would have duplicate URLs.
Another solution would be to save the last-viewed zip code as a cookie, but that's not RESTful. Is there a solution?