Subdirectory pointing at different website – possible?

I think what I’m asking is impossible but here goes.

I have two sites, one is wordpress hosted on an apache server. Let’s call this one mydomain.com

Read More

The other is on IIS and let’s call that one blog.mydomain.com

Is it possible to somehow have a subdirectory e.g. mydomain.com/blog point at blog.mydomain.com ?

As the two sites are built on different platforms I’m currently having to keep them on separate domains but ideally I’d like them to behave like this – wordpress as my main site and the subfolder is my .Net site.

I know if it was all .Net and IIS it would be possible to have a virtual directory point at a different app but this isn’t a realistic possibility for me.

I think this is going to be impossible to achieve but any advice or recommendations would be most welcome.
Thanks

Related posts

Leave a Reply

2 comments

  1. Apache has a ProxyPass directive which will allow you to do this.

    Define it in your VirtualHost configuration of mydomain.com as follows:

    <VirtualHost *:80>
            ServerName mydomain.com
            ServerAlias mydomain.com
    
            ProxyPass /blog http://blog.mydomain.com/ retry=0
            ProxyPassReverse /blog http://blog.mydomain.com/
    
            # other directives
    
    </VirtualHost>
    

    You will also need to enable mod_proxy for Apache (and possibly other modules) as listed in the Apache documentation here.

    I will still say that what you are trying to do is not the ideal way to access the site. Besides the point that there will be a performance overhead due to the proxy operations, some site configurations are such that they are tied to a single domain and folder path. In such cases either the site will work with quirks (dangerous) or not work for the user at all (less dangerous). When I say dangerous I mean the user might be tricked into thinking that the site is working and perform an irreversible site operation which may be stuck in limbo or cause data corruption.