Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free.

Linking Structure for higher file locations
This is a linking question for image linking. I have apache2 setup for named-based virtual hosts with the base root set as /var/www/ . The layout is as follows:

  1. /var/www/site 1
  2. /var/www/site 2
  3. /var/www/common/
  4. /var/www/pictures/
  5. /var/www/music/
  6. /var/www/etc/...

Document roots point to each sites' sub-folder (i.e. www.site1.net points to /var/www/site1 as root). I can access both sites correctly from outside the local network. Links inside the site works as it seems to point to the reference root in document root.

The issue lies in pointing back ground images or any other files located in /var/www/any/file.file from the site1 and site2 document root.

What I have tried:

  1. [img style="width: 200px; height: 300px;" alt="test image" src="../pictures/Scroll-Background-invitatio.jpg">]
  2. [img style="width: 200px; height: 300px;" alt="test image" src="../../pictures/Scroll-Background-invitatio.jpg">]
  3. [img style="width: 200px; height: 300px;" alt="test image" src="http://www/mysite1.net/pictures/Scroll-Background-invitatio.jpg">]
  4. [img style="width: 200px; height: 300px;" alt="test image" src="pictures/Scroll-Background-invitatio.jpg">]

Basically, I have tried everything. I googled that seemed like it pertained to my situation but apparently my google-fu has gotten rusty. Bear in mind that this is the beginning of my third week going from nothing to a Linux box built and installed by myself (Ubuntu 12.04), Apache2-mysql-php5, and setting up my host while having a dynamic ip, and programming in languages I have never touched ( I quit doing this in early 90's and only ever touched html/dhtml).

I am VERY new to this. I have asking questions when there is so much info out there but I am stuck and am not sure what syntax i should use even in googling for an answer. If I am missing information that is needed, you have questions in order answer mine, or I should be posting this question elsewhere, feel free to ask or let me know. Many thanks in advance.
In my editor (kompozer). when creating the site ../pictures/image.jpg, the file shows in preview properly.

share|improve this question

closed as too localized by Tom Brossman, Raja, Thomas W., hhlp, vasa1 Mar 17 '13 at 14:56

This question is unlikely to help any future visitors; it is only relevant to a small geographic area, a specific moment in time, or an extraordinarily narrow situation that is not generally applicable to the worldwide audience of the internet. For help making this question more broadly applicable, visit the help center. If this question can be reworded to fit the rules in the help center, please edit the question.

1 Answer 1

Have you tried use Alias directive?

Alias /docs /var/web

I think you can do it on .htaccess file too, but it needs "AllowOverride All"

share|improve this answer
no .htaccess file atm, but tried alias and directory options (using webmin) it now shows a broken link to image so thats progress –  skittishtrigger Feb 15 '13 at 16:24
I found my problem. Apparently in apache it is the same as changing system config files and everything else dealing with any external dependencies that can be changed...Restart after every change. I compounded several errors by not reloading apache after configuration changes. –  skittishtrigger Feb 15 '13 at 23:52

Not the answer you're looking for? Browse other questions tagged or ask your own question.