[support] Path question

Shai Gluskin shai at content2zero.com
Thu Nov 19 03:10:58 UTC 2009


I'm not sure I totally understand your question, but I'll tell you what
works consistently for me with simplest possible set up on the server and no
.htaccess or mod_rewrite complications. This just works.

I always have my Drupal root at the domain root. For example:
http://www.example.com.

If I need to put the site in a subdirectory, I will always create a
sub-domain. For example, if the Drupal directory is at: example.com/drupal,
I will create a subdomain called drupal.example.com that transforms
example.com/drupal into a domain root (drupal.example.com).

One of the reasons I do this is that I find root-relative links to be the
most stable for links inside text areas. So links that I create inside nodes
or custom blocks to other places on the same site I'll make them
root-relative which is like, "/custompath" or "/longer/custompath".

Note however when you are in Drupal admin screens (as opposed to a node body
or custom block) you don't put the forward slash at the beginning. Drupal
itself doesn't have a hard time keeping track of where its root directory is
and beginning with a forward slash will not work.

I've had trouble with truly relative links created inside nodes, such as a
link like "custompath" or "node/1". Root-relative links take the guesswork
out. But the downside of root-relative is that they always go to the domain
root, even if the Drupal root is in a sub-directory.  And so that is why I
use the subdomain trick in those situations because the sub-domain
essentially changes the location of the domain root.

This system makes moving the site to another server, another domain, or
another directory on the same server, really, really simple.

Hope this makes some sense to you.

This isn't necessarily the "best" way, it's the way I've simplified things
for myself so I don't have to be too much of a server geek and I get
consistent results.

Shai

On Wed, Nov 18, 2009 at 7:41 PM, Néstor <rotsen at gmail.com> wrote:

> I have create a block that has some basic html links like
> <a href="/nestor/scroller612/as_dept/as_main">Admin Services</a>
>
> This works but if I were to move my drupal site this will not work.
>
> If I were to set the link as follows it will not work
> <a href="as_dept/as_main">Admin Services</a>
>
> Now what is the proper way to point to a link ina drupal page?
>
> How do you tell it to use the drupal site path + the location of the link
> you want to access?
>
> Thanks,
>
> Nestor :-)
>
> --
> [ Drupal support list | http://lists.drupal.org/ ]
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.drupal.org/pipermail/support/attachments/20091118/f5874c16/attachment.html 


More information about the support mailing list