[support] Multisite Paths

Richard Damon Richard at Damon-Family.org
Mon Dec 17 03:24:45 UTC 2012


On 12/16/12 8:33 PM, Kenneth Jacker wrote:
> Thanks, Richard, for your prompt reply.
>
>   rd> I think you misunderstand what multi-site does. 
>
> Apparently!
>
>   rd> Your directory sites/example.com is the directory that Drupal will
>   rd> look for for site specific data (modules, themes, etc), in
>   rd> addition to sites/all for the information for all sites, and the
>   rd> module and themes directories for core files.
>
> Overall, that has been my understanding:  sites/mysite, all and core.
>
>   rd> Multi-site does NOT make the sites/example.com the "Document Root"
>   rd> for the web server, if it did the the site could not access core
>   rd> or all sites files.
>
> Good point.
>
>   khj>    <a href="sites/example.com/images/jim.jpg">Jim</a>
>
> So this is correct, yes?
>
>   khj> Going to the page and clicking on the "Jim" link, does display the
>   khj> image correctly.  However, the URL in my browser shows this:
>   khj> 
>   khj>    http://example.com/sites/example.com/images/jim.jpg
>
> But why the above in the browser "URL bar"?
>
>
>
>   khj>     <a href="images/jim.jpg">Jim</a>   
>
> Here I *am* assuming a "htdoc root" at example.com ... wrong!
>
> I see now why this didn't work (and displayed an error message) ...
> "images" refers to a sub-dir directly under the "Document Root"
> directory.  Not where example.com has its JPEGs.
>
> If I can just get the browser URL right, I'll be good to go!
>
>
> Thanks for helping me with this,
>
>   -Kenneth
>
A relative URL (one that doesn't contain the full address) will be
converted to a full url by the browser, based on the url used to access
the page.

If you don't use the clean url option, then all (almost all?) page
accesses will be to the index.php at your Drupal root. Based on your
examples, that would be http://example.com/index.php
The first example.com in your browsers is the domain that the page is
being accessed from and the second is the name of a directory in the path.
Because of the way clean urls work, I tend to use URLs that specify the
path at least relative to the document root
(/sites/example.com/images/jim.jpg) because you may end up with content
at something like http://example.com/content/jim and if you used your
relative url on that page, the relative URL would resolve to
http://example.com/content/sites/example.com/images/jim.jpg which would
not find the image.

If you want the image URL to really be /images/jim.jpg then what you
need to do is set up a rule with .htaccess or a module to remap request
for //example.com/images to //example.com/sites/example.com/images

-- 
Richard Damon



More information about the support mailing list