Forum Moderators: phranque
/var/www/html
there is a folder /var/www/html/abc
Now I need to setup a virtual host (www.example2.com) that uses /var/www/html/abc as its DocumentRoot
The problem is that for many files in /var/www/html/abc, their links are based on main site's DocumentRoot, as during development, we do not expect /abc will be DocumentRoot for a virtual host
For example, in about.html at /var/www/html/abc, it may has an image like
<a href="/images/hello.jog">Image</a>
/image here refers to /var/www/html/image
Now, when visitors go to www.example2.com, I want them to see the image as well, without requiring me to copy /var/www/html/image to /var/www/html/abc or to change all such links in all files in /foo
Any idea?
Thanks
ln -s /var/www/html/image /var/www/html/abc/image Alternatively you can modify the Apache configuration and use an Alias [httpd.apache.org].
The final, and often best, option is not to have one site within the document root of the other at all. You can create extra domains or subdomains within /home, for example - then you can set aliases for shared files for each domain.
To use alias will work, but does not resolve all problems. While I can set alias for "image", that only applies for situations that I know them in advance.
I am looking for a solution that web server will first try to find a file in this site's Documentroot, if not found , then go to main site's documentroot to find.