title: Apache Reverse Proxy to a Wordpress site passes subpath when it shouldn't
body: <p>I've been trying to set up a reverse proxy on a main website to a blog site of the url format</p>
  
  <p>example.com/blog -> blog.example.com</p>
  
  <p>example.com/blog is on an Apache instance and in the <code>httpd.conf</code> I have added the following.</p>
  
  <pre><code>SSLProxyEngine on
  
  ProxyPreserveHost Off
  ProxyRequests Off
  
  ProxyPassMatch /blog https://blog.example.com
  ProxyPassReverse /blog https://blog.example.com
  </code></pre>
  
  <p>This all works but it keeps 404ing. The good news is it is actually reverse proxying correctly because it grabs the 404 page of the blog. </p>
  
  <p>After looking at the apache access logs I found that it is passing the subpath for whatever reason <code>/blog</code> to <code>blog.example.com</code> so its fetching <code>blog.example.com/blog</code>. When users navigate to <code>/blog</code>, it does 404 naturally. However, my understanding was when setting up <a href="https://httpd.apache.org/docs/2.2/en/mod/mod_proxy.html#proxypassreverse" rel="nofollow"><code>ProxyPassReverse</code></a> is it would make the request at what was specified so in my above case it should be requesting <code>blog.example.com</code> and not passing the <code>/blog</code> at the end.</p>
  
  <p>Here is the snippet from the documentation that confirms the above in how it should work:</p>
  
  <blockquote>
    <p>For example, suppose the local server has address <a href="http://example.com/" rel="nofollow">http://example.com/</a>; then</p>
  </blockquote>
  
  <pre><code>ProxyPass /mirror/foo/ http://backend.example.com/
  ProxyPassReverse /mirror/foo/ http://backend.example.com/
  ProxyPassReverseCookieDomain backend.example.com public.example.com
  ProxyPassReverseCookiePath / /mirror/foo/
  </code></pre>
  
  <blockquote>
    <p>will not only cause a local request for the <a href="http://example.com/mirror/foo/bar" rel="nofollow">http://example.com/mirror/foo/bar</a> to be internally converted into a proxy request to <a href="http://backend.example.com/bar" rel="nofollow">http://backend.example.com/bar</a> (the functionality which ProxyPass provides here). </p>
  </blockquote>
  
  <p>Any ideas why this might be? Worst case I might try to add a redirect or a rewrite so <code>/blog</code> goes to the homepage but I do have my permalinks set up in such a way that the <code>/blog</code> is in the slug of articles.</p>
  
  <p>FYI I am using Apache 2.2.</p>