External URLs should have a trailing '/' added if they're entered as simply a domain name, e.g. "drupal.org"
In function link_cleanup_url, I've added this to the ($type == LINK_EXTERNAL) condition
if (strpos (preg_replace ('/^([a-z0-9][a-z0-9\.\-_]*:\/\/)/i', '', $url), '/') === FALSE) {
$url .= '/';
}
Comments
Comment #1
quicksketchIs there a particular reason for adding the slash by some standard? I'm not sure why it's necessary.
Comment #2
magnusk commentedto avoid a server redirection when following the link? I think all web servers add the trailing slash to the URL when no path is specified (in other words, they redirect the browser so that the path is '/').
Comment #3
dragonwize commentedI never really paid much attention the trailing slash for straight domains but after a little research it does appear that a trailing slash on the root domain is required. Most web servers as mentioned just redirect properly.
I was concerned about the SEO implications of this because of the fact that search indexes treat urls with and without a trailing slash as different urls. I found out thought that is not the case, at least for google. In fact if you look at all the root domain links in a google search, they all have a trailing slash.
We will have to ensure that we are only adding the trailing slash to root domain urls only to avoid SEO implications.
Comment #4
dqd