The best way to accomplish this is to not add another URL segment, but to use a URL/GET parameter. For example www.somesite.com/photo?city=newyork
. Then you can write a validation rule that city
is required. This is the most flexible system which will allow you to add additional parameters, as needed, without changing routes in the future. Examples:
www.somesite.com/photo?city=newyork&order=name_asc
www.somesite.com/photo?city=newyork&type=donut_shop
www.somesite.com/photo?city=newyork&order=name_asc&type=donut_shop
If you're interested more in Resource controllers and/or building API's you should check out this book. You'll be able to pick up some good tips.