Add slash to the base url
mdounin at mdounin.ru
Wed Mar 31 20:24:48 MSD 2010
On Wed, Mar 31, 2010 at 03:52:22PM +0200, Prateek Dayal wrote:
> > Yes, "http://localhost" and "http://localhost/" are identical from
> > HTTP point of view. It's up to your browser to show it one or
> > another way.
> Thanks for the reply. I understand what you are saying but from a search
> engine point of view, they are two different urls. In fact I am making
> this change after reading this in the google reportcard -
Again: "http://localhost" and "http://localhost/" are identical.
Always. There is no difference. It's the same as
"http://example.com:80/" and "http://example.com/". Port defaults
to 80, path defaults to "/".
I personally think that it's better to write with trailing slash
as it's in line with directory links ("http://example.com/dir" ->
"http://example.com/dir/", as they are in fact different). But
it's completely presentational, nothing more.
> So assuming that I want http://localhost to 301 redirect to
> http://localhost/, how do I go about doing it?
You can't do anything. Server don't see if there was "/" or not
in the original URL, it always get request with "/". RFC 2616
explicitly requires "/" if there are no path:
: ... Note that the absolute path
: cannot be empty; if none is present in the original URI, it MUST be
: given as "/" (the server root).
More information about the nginx