{
    # vim: ft=perl:

    $haveSSL = (exists ${modSSL}{status} and ${modSSL}{status} eq "enabled") ?  'yes' : 'no';

    $OUT = '';
    if ((${'backuppc'}{'status'} || 'disabled') eq 'enabled' &&
        (${'httpd-bkpc'}{'status'} || 'disabled') eq 'enabled'){

		$OUT .= "    RewriteRule ^/backuppc(/.*|\$)    https://%{HTTP_HOST}/BackupPC\$1 [L,R]\n";

        if (($port eq "80") && ($haveSSL eq 'yes')){
            $OUT .= "    RewriteRule ^/BackupPC(/.*|\$)    https://%{HTTP_HOST}/BackupPC\$1 [L,R]\n";
        }
        else{
            $OUT .= "    ProxyPass /BackupPC http://127.0.0.1:${'httpd-bkpc'}{TCPPort}/BackupPC\n";
            $OUT .= "    ProxyPassReverse /BackupPC http://127.0.0.1:${'httpd-bkpc'}{TCPPort}/BackupPC\n";
        }

        $OUT .=<<"HERE";

    <Location /BackupPC>
        SSLRequireSSL on
        order deny,allow
        deny from all
        allow from $localAccess $externalSSLAccess
    </Location>

HERE
    }
}
