Redirecting a folder in a VirtualHost with Apache2

apache-2.2reverse-proxyvirtualhost

I've set up Apache2 on a small home server and I'm trying to get Transmission running through it. I've got it working just fine, but I'm having an issue where the redirect I've set up for the transmission vhost is also working on the main site. This will make it impossible to host any other web app at the main site. Here's my http-vhosts.conf file that includes the redirect:

NameVirtualHost *:80
<VirtualHost *:80>
    ServerName transmission.blah.fakedns.com
    ServerAlias transmission.blah.fakedns.com

    ProxyRequests Off

    ProxyPass /transmission http://127.0.0.1:9091/transmission
    ProxyPassReverse /transmission http://127.0.0.1:9091/transmission
    Redirect permanent / /transmission/web/

    <Location /transmission>
        Order Allow,Deny
        Allow from All
    </Location>
</VirtualHost>

I want the redirect to ONLY work under the transmission subdomain. Currently if I go to blah.fakedns.com/ I'll get redirected to blah.fakedns.com/transmission/web/ and it loads fine – but I don't want it to. Is there something wrong with my vhosts file above?

Also the reverse-proxy with mod_proxy should only be working for the subdomain as well so I'm having the same issue with that.

I understand that I've been using the term 'subdomain' thus far to refer to sub-subdomains, but I've got it all hooked up to a DynDNS account so I can only add new sub-subdomains, could that be an issue?

Thanks in advance for any help!

Best Answer

Have you defined a vhost for the servername "blah.fakedns.com" ?

If you don't have done that, Apache will take the first loaded vhost as a "fallback" vhost whenever the host name is not defined anywhere in Apache.

This would make sense since if you don't have defined the other vhost for the apps you want to access, Apache will serve you with the first vhost it has loaded (probaby the one about Transmission)

I hope this helps you.