Hi
I have a domain set up that hosts a Perl cgi web application consisting of a couple of dozen scripts.
Users access the system via a PHP login script in the document root which, assuming successful login, redirects the user to a script in the cgi-bin. So, usual directory structure applies:
/var/www/vhosts/domain1.com/httpdocs
/var/www/vhosts/domain1.com/cgi-bin
So, they log in at
http://domain1.com/index.php
which takes them to
http://domain1.com/cgi-bin/home.cgi
and the system is branded as "DOMAIN1".
That all works fine, but what I want to do is create a second domain which uses all the login/cgi scripts under domain1.com but is branded "DOMAIN2" and shows domain2.com in the address bar.
To do this I've created a vhost.conf file in
/var/www/vhosts/domain2.com/conf that is included in the appropriate apache conf file.
Inside the file I've put these lines:
<Directory /var/www/vhosts/domain1.com/httpdocs>
php_admin_flag engine on
</Directory>
Alias /index.php /var/www/vhosts/domain1.com/httpdocs/index.php
Now that works, i.e: I go to
http://domain2.com/index.php
and it presents the login page and I can log in successfully. It's the next bit I can't get to work.
That is, the login script redirects to "/cgi-bin/home.cgi" and I see
http://domain2.com/cgi-bin/home.cgi
in the address bar, which is what I want, but I get a "404 file not found" message.
I've tried the following lines in vhost.conf but they both result in a 404:
ScriptAliasMatch ^/cgi-bin/(.*)$ /var/www/vhosts/domain1.com/cgi-bin/$1
and also same line but with Alias/AliasMatch/ScriptAlias; or
ScriptAlias /cgi-bin/home.cgi /var/www/vhosts/domain1.com/cgi-bin/home.cgi
Does anyone know why that isn't working?
Thanks
Bigus