The FreeBSD Diary

The FreeBSD Diary (TM)

Providing practical examples since 1998

If you buy from Amazon USA, please support us by using this link.
[ HOME | TOPICS | INDEX | WEB RESOURCES | BOOKS | CONTRIBUTE | SEARCH | FEEDBACK | FAQ | FORUMS ]

Things look quiet here. But I've been doing a lot of blogging at dan.langille.org because I prefer WordPress now. Not all my posts there are FreeBSD related. I am in the midst of migrating The FreeBSD Diary over to WordPress (and you can read about that here). Once the migration is completed, I'll move the FreeBSD posts into the new FreeBSD Diary website.

Linking to other directories with Apache 20 February 1999
Share
Need more help on this topic? Click here
This article has no comments
Show me similar articles
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 directory (/usr/home/susan).

My first thought was to create a symbolic link between the main website directory and the home directory.  However, there is another way: Alias.

symbolic link
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:

chmod o+x /usr/home/susan/

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:

chmod o+r,o+x /usr/home/susan/public_html

alias
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 210.55.210.87>
   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     webmaster@example.com
   Alias           /susanalias/ /usr/home/susan/public_html/
</VirtualHost>

You can see the alias definition above.  This allows http://test.freebsddiary.org/susanalias/ to work.

Share
Need more help on this topic? Click here
This article has no comments
Show me similar articles