Skip to main content
Clarified that "DirectorySlash On" is effectively the default behaviour.
Source Link
MrWhite
  • 43.1k
  • 4
  • 50
  • 90

Yes, all mainstream browsers "append a slash" to the HTTP request when requesting a bare domain URL (ie. the homepage). This is actually necessary in order to make the HTTP request valid, which for http://example.com/ is:

GET / HTTP/1.1
Host: example.com

Note the / (slash) in the first line - this is the URL being requested. It is not valid to have nothing here. From RFC 2616:

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

You need to look at the HTTP request the browser makes to the server. The URL displayed in the "status bar of the browser", or even the URL in the address bar could be different - more user friendly. Google Chrome does not append the trailing slash in the status bar, although the slash is present in the request.

No 301 redirect occurs if you specify http://example.com (no slash) because the browser corrects the HTTP request before it is made.

Note that this is different to slashes being added to the end of URLs when there is a path/directory. eg. http://example.com/directory/. The article you link to seems to treat both the same and does not appear to be entirely correct IMO. If you requested http://example.com/directory (no slash) then the browser does not append a slash and yes, most servers will 301 redirect to http://example.com/directory/ (slash) - but this is dependent on the server; it could simply break! On Apache, for instance, this is dependent on the DirectorySlash On directive being set to on(which is the default).

Yes, all mainstream browsers "append a slash" to the HTTP request when requesting a bare domain URL (ie. the homepage). This is actually necessary in order to make the HTTP request valid, which for http://example.com/ is:

GET / HTTP/1.1
Host: example.com

Note the / (slash) in the first line - this is the URL being requested. It is not valid to have nothing here. From RFC 2616:

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

You need to look at the HTTP request the browser makes to the server. The URL displayed in the "status bar of the browser", or even the URL in the address bar could be different - more user friendly. Google Chrome does not append the trailing slash in the status bar, although the slash is present in the request.

No 301 redirect occurs if you specify http://example.com (no slash) because the browser corrects the HTTP request before it is made.

Note that this is different to slashes being added to the end of URLs when there is a path/directory. eg. http://example.com/directory/. The article you link to seems to treat both the same and does not appear to be entirely correct IMO. If you requested http://example.com/directory (no slash) then the browser does not append a slash and yes, most servers will 301 redirect to http://example.com/directory/ (slash) - but this is dependent on the server; it could simply break! On Apache, for instance, this is dependent on the DirectorySlash directive being set to on.

Yes, all mainstream browsers "append a slash" to the HTTP request when requesting a bare domain URL (ie. the homepage). This is actually necessary in order to make the HTTP request valid, which for http://example.com/ is:

GET / HTTP/1.1
Host: example.com

Note the / (slash) in the first line - this is the URL being requested. It is not valid to have nothing here. From RFC 2616:

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

You need to look at the HTTP request the browser makes to the server. The URL displayed in the "status bar of the browser", or even the URL in the address bar could be different - more user friendly. Google Chrome does not append the trailing slash in the status bar, although the slash is present in the request.

No 301 redirect occurs if you specify http://example.com (no slash) because the browser corrects the HTTP request before it is made.

Note that this is different to slashes being added to the end of URLs when there is a path/directory. eg. http://example.com/directory/. The article you link to seems to treat both the same and does not appear to be entirely correct IMO. If you requested http://example.com/directory (no slash) then the browser does not append a slash and yes, most servers will 301 redirect to http://example.com/directory/ (slash) - but this is dependent on the server; it could simply break! On Apache, for instance, this is dependent on DirectorySlash On being set (which is the default).

Added more infor about URLs with directories
Source Link
MrWhite
  • 43.1k
  • 4
  • 50
  • 90

Yes, all mainstream browsers "append a slash" to the HTTP request when requesting a bare domain URL (ie. the homepage). This is actually necessary in order to make the HTTP request valid, which for http://example.com/ is:

GET / HTTP/1.1
Host: example.com

Note the / (slash) in the first line - this is the URL being requested. It is not valid to have nothing here. From RFC 2616:

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

You need to look at the HTTP request the browser makes to the server. The URL displayed in the "status bar of the browser", or even the URL in the address bar could be different - more user friendly. Google Chrome does not append the trailing slash in the status bar, although the slash is present in the request.

No 301 redirect occurs if you specify http://example.com (no slash) because the browser corrects the HTTP request before it is made.

Note that this is different to slashes being added to the end of URLs when there is a path/directory. eg. http://example.com/pathdirectory/. The article you link to seems to treat both the same and does not appear to be entirely correct IMO. If you requested http://example.com/directory (no slash) then the browser does not append a slash and yes, most servers will 301 redirect to http://example.com/directory/ (slash) - but this is dependent on the server; it could simply break! On Apache, for instance, this is dependent on the DirectorySlash directive being set to on.

Yes, all mainstream browsers "append a slash" to the HTTP request when requesting a bare domain URL (ie. the homepage). This is actually necessary in order to make the HTTP request valid, which for http://example.com/ is:

GET / HTTP/1.1
Host: example.com

Note the / (slash) in the first line - this is the URL being requested. It is not valid to have nothing here. From RFC 2616:

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

You need to look at the HTTP request the browser makes to the server. The URL displayed in the "status bar of the browser", or even the URL in the address bar could be different - more user friendly. Google Chrome does not append the trailing slash in the status bar, although the slash is present in the request.

Note that this is different to slashes being added to the end of URLs when there is a path/directory. eg. http://example.com/path/. The article you link to seems to treat both the same and does not appear to be entirely correct IMO.

Yes, all mainstream browsers "append a slash" to the HTTP request when requesting a bare domain URL (ie. the homepage). This is actually necessary in order to make the HTTP request valid, which for http://example.com/ is:

GET / HTTP/1.1
Host: example.com

Note the / (slash) in the first line - this is the URL being requested. It is not valid to have nothing here. From RFC 2616:

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

You need to look at the HTTP request the browser makes to the server. The URL displayed in the "status bar of the browser", or even the URL in the address bar could be different - more user friendly. Google Chrome does not append the trailing slash in the status bar, although the slash is present in the request.

No 301 redirect occurs if you specify http://example.com (no slash) because the browser corrects the HTTP request before it is made.

Note that this is different to slashes being added to the end of URLs when there is a path/directory. eg. http://example.com/directory/. The article you link to seems to treat both the same and does not appear to be entirely correct IMO. If you requested http://example.com/directory (no slash) then the browser does not append a slash and yes, most servers will 301 redirect to http://example.com/directory/ (slash) - but this is dependent on the server; it could simply break! On Apache, for instance, this is dependent on the DirectorySlash directive being set to on.

added 116 characters in body
Source Link
MrWhite
  • 43.1k
  • 4
  • 50
  • 90

Yes, all mainstream browsers "append a slash" to the HTTP request when requesting a bare domain URL (ie. the homepage). This is actually necessary in order to make the HTTP request valid, which for http://example.com/ is:

GET / HTTP/1.1
Host: example.com

Note the / (slash) in the first line - this is the URL being requested. It is not valid to have nothing here. From RFC 2616:

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

You need to look at the HTTP request the browser makes to the server. The URL displayed in the "status bar of the browser", or even the URL in the address bar could be different - more user friendly. Google Chrome does not append the trailing slash in the status bar, although the slash is present in the request.

Note that this is different to slashes being added to the end of URLs when there is a path/directory. eg. http://example.com/path/. The article you link to seems to treat both the same and does not appear to be entirely correct IMO.

Yes, all mainstream browsers "append a slash" to the HTTP request when requesting a bare domain URL. This is actually necessary in order to make the HTTP request valid, which for http://example.com/ is:

GET / HTTP/1.1
Host: example.com

Note the / (slash) in the first line - this is the URL being requested. It is not valid to have nothing here. From RFC 2616:

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

You need to look at the HTTP request the browser makes to the server. The URL displayed in the "status bar of the browser", or even the URL in the address bar could be different - more user friendly. Google Chrome does not append the trailing slash in the status bar, although the slash is present in the request.

Note that this is different to slashes being added to the end of URLs when there is a path/directory. eg. http://example.com/path/. The article you link to seems to treat both the same and does not appear to be entirely correct IMO.

Yes, all mainstream browsers "append a slash" to the HTTP request when requesting a bare domain URL (ie. the homepage). This is actually necessary in order to make the HTTP request valid, which for http://example.com/ is:

GET / HTTP/1.1
Host: example.com

Note the / (slash) in the first line - this is the URL being requested. It is not valid to have nothing here. From RFC 2616:

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

You need to look at the HTTP request the browser makes to the server. The URL displayed in the "status bar of the browser", or even the URL in the address bar could be different - more user friendly. Google Chrome does not append the trailing slash in the status bar, although the slash is present in the request.

Note that this is different to slashes being added to the end of URLs when there is a path/directory. eg. http://example.com/path/. The article you link to seems to treat both the same and does not appear to be entirely correct IMO.

added 116 characters in body
Source Link
MrWhite
  • 43.1k
  • 4
  • 50
  • 90
Loading
Source Link
MrWhite
  • 43.1k
  • 4
  • 50
  • 90
Loading