I've been told that these both behave different in terms of loading resources on the page
http://domain.com/folder
http://domain.com/folder/
However I've also noticed that no matter what I do, the browser redirect http://domain.com/folder to http://domain.com/folder/
So I wanted to ask -- what's the major difference between the two? What should I do for my browser to not redirect (or add the end slash)
They are different URLs. The biggest difference between them is that URLs consisting of relative paths will resolve from http://example.com/
for one and http://example.com/folder/
for the other.
However I've also noticed that no matter what I do, the browser redirect
No, it won't.
Given a path that the HTTP server resolves as a static directory on the file system, the default configuration of most HTTP servers is to send an HTTP redirect to add the /
on the end.
It is the server redirecting, not the browser.
How you change that depends on the server, not the browser.
What should I do for my browser to not redirect (or add the end slash)
Generally speaking, you shouldn't. That's normal behaviour. (And, as mentioned, it depends on your server.)
If the changing path is causing problems for relative URIs, then use relative URIs with absolute paths in them (i.e. which start with a /
).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With