You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
URLs with and without trailing slashes are considered to be different. Serving the same content behind a URL with and without a trailing slash may be considered duplicate content by search engines.
There should be a way to redirect all URLs (via 301 Moved Permanently) to their canonical equivalent. That includes removing empty segments as well as redirecting to the variant with or without trailing slash (that should be selectable – I prefer trailing slashes, because I can then easily add subpages later).
EDIT: Trailing slashes should not be added if a file is accessed, so this seems to be more complicated after all. One can also consider interpreting . and .., this might even be necessary if HTML pages use relative URLs (like <img src="../images/1.jpg">), but I don’t know to what extent browsers are already required to resolve this before sending the request.
The text was updated successfully, but these errors were encountered:
Why do you need to serve the same content under two different urls (with and without a trailing slash) in the first place? These urls are certainly different and I believe gotham's router does not alter trailing slashes, neither in your router definitions nor in the urls requested from the client, and I believe it should remain this way.
If you require to implement this in your server, you're stuck with the "run something before the router" problem (unless you want to add all routes twice) - this has been a long-standing issue in gotham (#292).
I don’t really want to serve different content, I want to avoid serving the same content under two different URLs. And a URL with a trailing slash is different from a URL without a trailing slash. It’s common practice to redirect one to the other, but Gotham currently doesn’t seem to have way to accomplish this.
Today is my first day with Gotham. I’m currently evaluating different frameworks to see which one serves my needs.
URLs with and without trailing slashes are considered to be different. Serving the same content behind a URL with and without a trailing slash may be considered duplicate content by search engines.
There should be a way to redirect all URLs (via 301 Moved Permanently) to their canonical equivalent. That includes removing empty segments as well as redirecting to the variant with or without trailing slash (that should be selectable – I prefer trailing slashes, because I can then easily add subpages later).
EDIT: Trailing slashes should not be added if a file is accessed, so this seems to be more complicated after all. One can also consider interpreting
.
and..
, this might even be necessary if HTML pages use relative URLs (like<img src="../images/1.jpg">
), but I don’t know to what extent browsers are already required to resolve this before sending the request.The text was updated successfully, but these errors were encountered: