Pretty URLs for search pages

后端 未结 6 2100
隐瞒了意图╮
隐瞒了意图╮ 2020-12-01 13:31

I really enjoy having \"pretty\" URLs (e.g. /Products/Edit/1 instead of /products.aspx?productID=1) but I\'m at a loss on how to do this for pages

6条回答
  •  天命终不由人
    2020-12-01 13:54

    As mentioned before - using HTTP Post would be best but then you lose the ability for people to send the link to people/bookmark it. Leaving the query string in the URL isn't going to be too bad. I have it set up so that the url string is like this:

    http://example.com/search/?productType={producttype}&name={name}&address={address}

    And then for paginating the search results add in the page number before the query string (so the query string is customizable if needed.

    • Page 1: http://example.com/search/?productType={producttype}&name={name}
    • Page 2: http://example.com/search/2/?productType={producttype}&name={name}
    • Page 3: http://example.com/search/3/?productType={producttype}&name={name}

    etc...

    At the end of the day - the king of search 'Google' don't mind leaving the query string in the URL so it can't be too bad :)

提交回复
热议问题