I want my site to show up as www.mysite.com, not www.mysite.com/
Does Apache add a trailing slash after a domain name by default, or does the browser append it? If I want to prevent this using an .htaccess, what would the url rewrite rule be?
I want my site to show up as www.mysite.com, not www.mysite.com/
Does Apache add a trailing slash after a domain name by default, or does the browser append it? If I want to prevent this using an .htaccess, what would the url rewrite rule be?
http://www.searchenginejournal.com/linking-issues-why-a-trailing-slash-in-the-url-does-matter/13021/
http://www.alistapart.com/articles/slashforward/
URLs were initially used to model directories, so the trailing slash was required. I think if you don't have the trailing slash some webservers will not be able to find the content correctly.
As explained by Anthony's first link, the slash is part of the address. Every domain (and not just "the vast majority") has a name resembling www.mysite.com, but this is just a domain name, not an URL. An URL is the address of a file, ie protocol+domainname+pathfile, so http://www.mysite.com/ is added the missing filename by DirectoryIndex and therefore is an URL, but http://www.mysite.com just doesn't mean anything since in this case the file path would be empty. The fact that your browser doesn't display the boring parts of your URL is not related to your website's configuration.
If really the same browser behaves differently on different websites, I would be curious to know what browser and what websites you used.
If you request:
http://myhost.com
The request needs to look like this in HTTP:
GET / HTTP/1.0
Host: myhost.com
For historical reasons, some browsers did append the slash because otherwise it translates to
GET <nothing> HTTP/1.0
Host: myhost.com
Which would be an illegal request.
Note that:
http://myhost.com/page
is legal, because it translates to:
GET /page HTTP/1.0
Host: myhost.com
Browser adds such slash automatically when requesting the URL. How it displaying in address bar it's a different story.
For example: www.adobe.com
-- type it in different browsers and see how they will display it:
http://www.adobe.com/
www.adobe.com
www.adobe.com
http://www.adobe.com/