user11931362
user11931362

Reputation:

How to right create url?

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?

Upvotes: 0

Views: 128

Answers (2)

J.Lin
J.Lin

Reputation: 5

why not request author by id after you already get a book? eg:

mysite.com/book/:id?bookeId=123

Upvotes: 1

Jordan Lipana
Jordan Lipana

Reputation: 447

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.

Upvotes: 1

Related Questions