[Fixed] How to right create url?

Issue

I have page, from which I call two query. This two query need id.
How can I pass this id in the URL?
For example I call book and author query.
I pass them in URL,

mysite.com/book/:id/author/:id
mysite.com/:id/:id

Which option would be better? or is there another better way?

Solution

The first one should be readable.
mysite.com/book/:id/author/:id

But I prefer using slug. Example below.

mysite.com/book-slug/author-slug

Then in your back end, just remove book- and author- to get their slug.
This way you can reduce the number of parameters in the URL.

Leave a Reply

(*) Required, Your email will not be published