[drupal-devel] "Automatic relative URL" generation?
Jeremy Epstein
jazepstein at gmail.com
Mon May 9 03:57:39 UTC 2005
> > Alternatively, maybe Drupal could allow the author to make a reference
> > like [[node/21832]] to do the same as above (and still support
> > pathauto aliases in the process).
As Gordon said, this is how Drupal works by default. No additional
modules or patches are needed to make your site work with a flexible
base URL. For example, my site is accessible via its main address,
www.greenash.net.au, and also via its secondary address,
www.greenash.com.au. Both of these addresses are pointing to the same
Drupal install. If you visit either of them, you will see that all the
URLs on my site change to reflect whatever address is being used by
the site's visitor.
There are two things that you should do to make this functionality work:
1. Type in all links on your site using only the relative path. For
example, if you're writing a new story node, and you're putting
hyperlinks in the text, make them 'href="node/123"' instead of
'href="mysite.com/node/123"'. Typing in 'href=""' will create a link
to the front page.
2. If you use parked domains (i.e. multiple domain names pointing at
one site, such as with my site), then make sure that you set the
$base_url in your sites/default/settings.php file as follows:
$base_url = "http://". $_SERVER["HTTP_HOST"];
Jaza.
More information about the drupal-devel
mailing list