The FreeBSD Diary
Providing practical examples since 1998If you buy from Amazon USA, please support us by using this link.
Linking to other directories with Apache 20 February 1999
I had a website, http://test.freebsddiary.org.
I had a user, susan. I wanted susan to have her website appear
as a subdirectory of my main site but allow her to store her HTML files in her home
My first thought was to create a symbolic link between the main website directory and the home directory. However, there is another way: Alias.
|A symbolic link is created using the ln command. See man
ln for more information. Here's how I create the symbolic link:
# cd /directory/of/main/web/site # ln -s /usr/home/susan/public_html/ susansym
This makes for the following URL: http://test.freebsddiary.org/susansym.
You may need to do this:
in order to get permission to display the directory contents. You will probably also have to give Apache permission to read the files. Perhaps this:
|Apache has the ability to create aliases. This alias can be global (affects all
webs) or local (affects only one web). For a global alias, modify srm.conf.
For a local alias, modify httpd.conf. Here's the virtual website
specifications for http://test.freebsddiary.org/:
<VirtualHost 220.127.116.11> DocumentRoot /usr/local/www/data/freebsddiary ServerName test.freebsddiary.org ErrorLog /var/log/apache/freebsddiary-error.log TransferLog /var/log/apache/freebsddiary-access.log ServerAdmin firstname.lastname@example.org Alias /susanalias/ /usr/home/susan/public_html/ </VirtualHost>
You can see the alias definition above. This allows http://test.freebsddiary.org/susanalias/ to work.