-1

What's the current best practice around path parameters in URLs?

For instance

/artist/name

A long time ago I might have made artist.html and then passed in a query parameter /artist.html?name=name but it seems path parameters are the standard (and nicer to look at).

So assume I'm using apache, nginx, etc. Are these just rewritting /artist/name to '/artist.html?name=name` and then the Javascript is reading the query parameters? How is this done in the static html / ajax world we live in?

Thanks

3
  • 2
    Your question is unclear. Why are you talking about JavaScript? What do you mean by “static HTML/AJAX world we live in”? You are probably looking for the term “URL rewriting��. Commented Aug 22, 2015 at 20:03
  • By static html page -- I mean static html pages that are not manipulated by the server via a template / jsp like pages.
    – Shaun
    Commented Aug 23, 2015 at 17:52
  • youtube.com/watch?v=pspy1H6A3FM
    – Shaun
    Commented Nov 2, 2016 at 20:45

1 Answer 1

0

While that's probably how it used to be before (and I do remember writing stuff like that myself), modern websites tend to use web frameworks such as Flask or Django or Ruby on Rails instead of static pages and rewrites.

These frameworks include URL routing, where a certain pattern in the path, for example /artist/<name>, can be mapped to a function getArtist(name).

The query string may then be read by either the backend program or some JavaScript in the page.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.