Note that there are some explanatory texts on larger screens.

plurals
  1. PODynamic URLs - with or without a trailing slash?
    text
    copied!<p>The short question is - what is the best practice - to use or not to use a trailing slash in URLs.</p> <p>There are many articles: <a href="http://sebastians-pamphlets.com/thou-must-not-steal-the-trailing-slash-from-my-urls/#why-stealing-slashes-is-plain-robbery" rel="noreferrer">this</a>, <a href="http://www.standardzilla.com/2007/07/09/dont-forget-your-trailing-slash/" rel="noreferrer">this</a>, <a href="http://www.fiftyfoureleven.com/weblog/search-engines/trailing-slashes-best-practice" rel="noreferrer">this</a>.</p> <p>However, they all seem to deal with static directory structure. What about dynamic urls, like those rewritten, or those handled by a central facility (like a web framework, for example), that forward to internal resources depending on convention/configuration. For them it is no longer the case that the web server actually searches and figures out exact locations - it is just a matter of parsing.</p> <p>So, for example with spring mvc you declare that a given class method is invoked when the URI matches <code>/service/action/{pathParam}</code> - for this URL, imo, it does not make sense to have a trailing slash - the request is handled by one and the same servlet each time, which does the parsing.</p> <p>What I think is that one should just be consistent - either use trailing slashes everywhere, or don't use them at all.</p> <p>So:</p> <ul> <li>what's the best practice - with, without, or whatever-just be consistent</li> <li>what's the reason to choose one over the other</li> </ul>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload