#1
  1. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Nov 2012
    Posts
    37
    Rep Power
    2

    SEO friendly url with parameters?


    Hi there,



    I'm planning to overhaul a website to use friendly urls. The problem I have and can't quite find a solution for is how to carry extra parameter info with a friendly url?

    To explain further, say on one page, search.aspx there is a paged grid of events and some drop down boxes or text boxes so the user can filter/search on events in the grid. For example: select box - months (Jan-Dec) text box - keyword search

    When an event is selected it goes to the detail page but in the querystring it passes the filter selections so these can be preset when returning to the page. For example the old url might be detail.aspx?month=1&search=quiz&page=3&eventid=30. On detail.aspx we can have a link back to the search page e.g. search.aspx?month=1&search=quiz&page=3 to preset the search as the user left it.

    But, I only want the friendly url to be something like, event/[event-id]/[event-title] such as: event/30/quiz-night-at-the-royal-oak. So the friendly url will not contain the user search options.

    I realise I could have event/[month]/[search text]/[page]/[event-id]/[event-title] but this seems wrong and is not the unique url for the event.

    I was wondering if something like event/30/quiz-night-at-the-royal-oak?month=1&search=quiz might work? But again, seems untidy?

    I know the search params could go in a session variable, but wanted to avoid that option.

    Any advice on the best way to work this?
  2. #2
  3. No Profile Picture
    Lost in code
    Devshed Supreme Being (6500+ posts)

    Join Date
    Dec 2004
    Posts
    8,317
    Rep Power
    7170
    I was wondering if something like event/30/quiz-night-at-the-royal-oak?month=1&search=quiz might work? But again, seems untidy?
    This is the most logical way to do it.

    The point of the path part of the URL is to uniquely identify the resource. /event/30/quiz-night-at-the-royal-oak/ does that. month=1 and search=quiz have nothing to do with uniquely identifying the resource, they are simply extra parameters. Thus it is completely proper to include them as query string parameters and it does not make sense to include them as part of the path.
    PHP FAQ

    Originally Posted by Spad
    Ah USB, the only rectangular connector where you have to make 3 attempts before you get it the right way around

IMN logo majestic logo threadwatch logo seochat tools logo