Forum OpenACS Q&A: Re: Problem redirecting domain name to subsite (with apache virtualhost)

I've got the setup working with Apache/virtual hosts mapped using the nost node map. It works more or less flawlessly, although I struggled with it initially.

Here are my virtual host files:

(Old domain)

<VirtualHost 123.456.789>
        ServerName www.myolddomain.nl
        ServerAlias myolddomain.nl

        Documentroot "/usr/local/www/myolddomain.nl/www"
        DirectoryIndex index.php index.php3 index.html index.cgi index.htm home.htm

        ErrorLog /var/www/myolddomain.nl/www/error_log
        CustomLog /var/www/myolddomain.nl/www/access_log combined

        Alias /stats  /usr/local/stats/myolddomain.nl/www

        ProxyRequests           Off
        ProxyPass               /       http://myolddomain.nl:82/
        ProxyPassReverse        /       http://myolddomain.nl:82/
</VirtualHost>

(New domain)

<VirtualHost 123.456.789>
        ServerName www.mynewdomain.nl
        ServerAlias mynewdomain.nl

        Documentroot "/usr/local/www/myolddomain.nl/www/mynewdomain"
        DirectoryIndex index.php index.php3 index.html index.cgi index.htm home.htm

        ErrorLog /var/www/mynewdomain.nl/www/error_log
        CustomLog /var/www/mynewdomain.nl/www/access_log combined

        Alias /stats  /usr/local/stats/mynewdomain.nl/www

        ProxyRequests           Off
        ProxyPass               /       http://mynewdomain.nl:82/
        ProxyPassReverse        /       http://mynewdomain.nl:82/
</VirtualHost>

You may not need all the lines in the virtual host files, but these ones work for me.

One thing you may need to do is to manually create the subdirectory you are using as your subsite location. I had some of the same problems you are referring to until I went in and manually created the "mynewdomain" directory under the "www" directory of the main site (note the "Documentroot" parameter for the new domain).

I don't think you want your ProxyPass parameter on the new domain to be pointing to the old domain. You want to let the request processor on the main site process the request through the host node map.