[drupal-docs] [bug] $base_url setting misleading
fgm
drupal-docs at drupal.org
Wed Sep 28 14:30:47 UTC 2005
Issue status update for
http://drupal.org/node/32220
Post a follow up:
http://drupal.org/project/comments/add/32220
Project: Documentation
Version: <none>
Component: Installation
Category: bug reports
Priority: normal
Assigned to: Anonymous
Reported by: QuasiEvil
Updated by: fgm
Status: by design
Yes, I read that: it's already clear (to you, to me, and many others)
and that's why I knew the answer myself. However, seeing as I've
already answered this questions several times to new site owners, and
how it appears in google, it seems to be a recurring questioning. See
http://plusvite.net/?a9160357 to see how much.
Maybe the issue is raised because using a rooted install (without a
path) makes it think to beginners that this "no trailing slash" issue
is only valid for bases like http://www.example.com instead of
http://www.example.com/
Maybe using a non-rooted example like http://www.example.com/some/path
would make it clearer ?
Of course, accepting both syntaxes would obviously remove the problem
altogether. It would be sufficient to rewrite $base_url when it is
first read, like this:
<?php
$base_url = preg_replace ('/\/$/', '', $base_url) ;
?>
to avoid the problem altogether.
fgm
Previous comments:
------------------------------------------------------------------------
Mon, 26 Sep 2005 04:02:59 +0000 : QuasiEvil
Set $base_url to match the address to your Drupal site:
$base_url = "http://www.example.com";
this should be changed to
$base_url = "/drupal";
or at least not "localhost/drupal";
------------------------------------------------------------------------
Mon, 26 Sep 2005 05:40:34 +0000 : bslade
I assume this issue is referring to instructions in the INSTALL.txt file
that comes with the Drupal installation
Actually, I thought the $base_url variable is supposed to be full URL
(without the trailing slash). Eg. "http://localhost/drupal" or
"http://www.example.com/mydrupalsubdir".
------------------------------------------------------------------------
Mon, 26 Sep 2005 08:59:12 +0000 : Goba
Base URL should be a full URL with http:// (or https:// if you use
that). We are not going to change our advice, since it will not work
otherwise.
------------------------------------------------------------------------
Mon, 26 Sep 2005 09:32:43 +0000 : sepeck
Just a reference link for those who follow
http://www.w3.org/TR/WD-html40-970917/struct/links.html#edef-BASE
------------------------------------------------------------------------
Mon, 26 Sep 2005 23:22:55 +0000 : fgm
Actually, sepeck, if you refer to the W3C spec, I think this means the
"base" should be slash-terminated since the last component is a
directory, otherwise it designate a leaf document instead of a path
component. as shown in the W3C example you quote.
But it must not be slash-terminated, and seeing how I already had to
answer questions about this, it must be a frequent issue.
So $base_url is not really an URL, but just the string from which
drupal URLs are built. It would be clearer to allow the ending slash,
though, to make it an actual base URL, or to mention specifically in
the instructions that there must not be a slash at the end of $base_url
: the examples suggest it, but it does not seem to be sufficient.
------------------------------------------------------------------------
Tue, 27 Sep 2005 19:39:40 +0000 : clydefrog
fgm, you ask for instructions which ask to not include the trailing
slash. From settings.php in current HEAD (and 4.6):
<?php
/**
* Base URL:
*
* The URL of your website's main page. It is not allowed to have
* a trailing slash; Drupal will add it for you.
*/
$base_url = 'http://localhost';
?>
Whether this is a good idea, I have no opinion.
More information about the drupal-docs
mailing list