I was talking about what the browser does when you click on a link in
a web page.
Suppose you have a web page called
http://www.example.com/directory/page1.html and it contains this
hyperlink:
<a href="page2.html">Page 2</a>
When you click on that link, the browser has to figure out what
"page2.html" refers to. It's relative to the current page, so the
browser will request http://www.example.com/directory/page2.html.
Now suppose the page containing that link is
"http://www.example.com/directory/". The trailing "/" means that this
is logically a directory so when you click on that link the browser
requests http://www.example.com/directory/page2.html (same as before).
Now remove the trailing slash, so the web page's URL is
"http://www.example.com/directory". To the browser, this looks like a
file called "directory" in the directory "/". So when you click on the
Page 2 link you'll get http://www.example.com/page2.html which is
wrong.
That's why web servers don't treat http://www.example.com/directory/
and http://www.example.com/directory as the same thing - if they did,
relative links would sometimes fail, depending how you typed the URL
into the browser. Instead, as a convenience for those of us who are
too lazy to type the trailing "/", the web server will make sure the
URL ends with a "/" by sending a redirect response to force the
browser to fetch the correct URL.
--
Len
On 1/15/07, lightbulb432 <veerukrishnan@(protected):
>
> Could anyone please expand a little more on what's meant by the two
> statements below?
>
>
> Len Popp wrote:
> >
> > It doesn't matter if it's done by URLRewriteFilter or some other
> > method because it's the browser that interprets the relative URLs, not
> > the server.
> >
>
>
>
> > If the containing page's URL looks like a file when it's
> > really a directory, the browser will get them wrong.
> >
> --
> View this message in context: http://www.nabble.com/Trailing-slash-added-tf2970832.html#a8378938
> Sent from the Tomcat - User mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To start a new topic, e-mail: users@(protected)
> To unsubscribe, e-mail: users-unsubscribe@(protected)
> For additional commands, e-mail: users-help@(protected)
>
>
---------------------------------------------------------------------
To start a new topic, e-mail: users@(protected)
To unsubscribe, e-mail: users-unsubscribe@(protected)
For additional commands, e-mail: users-help@(protected)