For search engines, mostly Google, which is better:
This specific page has to rank high for keyword 2, and possibly keyword 1 too.
Webmasters Stack Exchange is a question and answer site for pro webmasters. It only takes a minute to sign up.Sign up to join this community
As @Henry Visotski says they're different. URLs are often seen by users and so you may want to optimise from that perspective. For example, if you have a whole slew of pages under a category then using the domain.com/subdir/page-keywords-here style makes sense as it implies that there are more pages in that subdir.
Moz.com have additional suggestions (dated 2015) that are pertinent here:
I've seen suggestions elsewhere that there's a tiny benefit in a keyword being earlier in a URL. But they're not proven results.
Your best bet is probably to do some A-B testing. Honestly though I think we've moved on from placement of keywords in URLs (unless it looks like stuffing); I don't think you'll see any difference.
These examples are two different things that denote the structure of the website, and where the document lives in the hierarchy. The first example shows "keyword1" to be a directory and "keyword2" to be a doc (or a subdirectory). The second example shows "keyword1-keyword2" to be a doc (or a subdirectory).
While there's a difference in how Google would perceive your site's structure and hierarchy, it's a small factor in whether you're going to rank for either keyword. In both cases, the keywords live in the URL, which takes care of that. But there are so many other factors to consider that I wouldn't lose any sleep over this detail.