[ Ubuntu-12.04.1; Drupal-7.17 ]
*ONE* I have a directory of images at,
/var/www/sites/example.com/images
and a "Basic Page" node with this HTML within it:
<a href="sites/example.com/images/jim.jpg">Jim</a>
Going to the page and clicking on the "Jim" link, does display the image correctly. However, the URL in my browser shows this:
http://example.com/sites/example.com/images/jim.jpg
Shouldn't that be:
http://example.com/images/jim.jpg ?
Why the extra, initial "example.com/sites"?
*TWO* If I use this anchor instead,
<a href="images/jim.jpg">Jim</a>
the browser bar displays
http://example.com/images/jim.jpg
But the page produces this error message instead of the JPEG:
The requested URL "/images/jim.jpg" was not found on this server.
Any help that you might provide is appreciated!
On 12/16/12 3:37 PM, Kenneth Jacker wrote:
[ Ubuntu-12.04.1; Drupal-7.17 ]
*ONE* I have a directory of images at,
/var/www/sites/example.com/images
and a "Basic Page" node with this HTML within it:
<a href="sites/example.com/images/jim.jpg">Jim</a>
Going to the page and clicking on the "Jim" link, does display the image correctly. However, the URL in my browser shows this:
http://example.com/sites/example.com/images/jim.jpg
Shouldn't that be:
http://example.com/images/jim.jpg ?
Why the extra, initial "example.com/sites"?
*TWO* If I use this anchor instead,
<a href="images/jim.jpg">Jim</a>the browser bar displays
http://example.com/images/jim.jpgBut the page produces this error message instead of the JPEG:
The requested URL "/images/jim.jpg" was not found on this server.Any help that you might provide is appreciated!
I think you misunderstand what multi-site does. your directory sites/example.com is the directory that Drupal will look for for site specific data (modules, themes, etc), in addition to sites/all for the information for all sites, and the module and themes directories for core files. Multi-site does NOT make the sites/example.com the "Document Root" for the web server, if it did the the site could not access core or all sites files.
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
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
On Sun, Dec 16, 2012 at 10:24 PM, Richard Damon wrote:
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
Or modify the httpd config for the vhost to add an alias to map sites/example.com/images to images. Or move sites/example.com/images to DocumentRoot (not advised).