title: Redirect to new domain based on path in Haproxy
body: <p>Hello and thanks ahead of time for the help.</p>
  
  <p>I have a blog on my old site and I'm trying to 301 redirect all of the posts to their new location on my new site using haproxy.  For example, I want  <a href="https://www.oldsite.com/john-blog/blogpost1" rel="nofollow">https://www.oldsite.com/john-blog/blogpost1</a> to be 301 redirected to <a href="https://www.newsite.com/jill-blog/blogpost1" rel="nofollow">https://www.newsite.com/jill-blog/blogpost1</a>.  </p>
  
  <p><a href="https://www.oldsite.com/john-blog" rel="nofollow">https://www.oldsite.com/john-blog</a> => <a href="https://www.newsite.com/jill-blog" rel="nofollow">https://www.newsite.com/jill-blog</a></p>
  
  <pre><code>frontend https
    option http-server-close
    reqadd X-Forwarded-Proto:\ https
  
    acl is_ob path_sub john-blog
  
    redirect location https://www.newsite.com/jill-blog code 301 if is_ob
  </code></pre>
  
  <p>I've figure out how to forward traffic for <code>/john-blog</code> but haven't been able to figure out how to do the rewrite so that <code>/john-blog/blogpost1</code> on the old site 301s to <code>/jill-blog/blogpost1</code> on the new site. </p>