Maxim Dounin
March 31, 2010 12:28PM
Hello!

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 -
> http://googlewebmastercentral.blogspot.com/2010/03/googles-seo-report-card.html

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:

http://tools.ietf.org/html/rfc2616#section-5.1.2

: ... Note that the absolute path
: cannot be empty; if none is present in the original URI, it MUST be
: given as "/" (the server root).

Maxim Dounin

_______________________________________________
nginx mailing list
nginx@nginx.org
http://nginx.org/mailman/listinfo/nginx
Subject Author Posted

Add slash to the base url

Prateek Dayal March 31, 2010 09:38AM

Re: Add slash to the base url

Maxim Dounin March 31, 2010 09:54AM

Re: Add slash to the base url

Prateek Dayal March 31, 2010 09:58AM

Re: Add slash to the base url

Piotr Sikora March 31, 2010 11:18AM

Re: Add slash to the base url

Prateek Dayal March 31, 2010 12:22PM

Re: Add slash to the base url

Maxim Dounin March 31, 2010 12:38PM

Re: Add slash to the base url

Piotr Sikora March 31, 2010 12:46PM

Re: Add slash to the base url

Prateek Dayal April 02, 2010 11:28PM

Re: Add slash to the base url

Maxim Dounin March 31, 2010 12:28PM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 127
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 500 on July 15, 2024
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready