title: How to redirect an URL to another server using Apache
body: <p>I have some trouble at work to do something I was asked to do.
  Our dev team developed some webservices and security policy is to use a reverse proxy between TheInternet and the webservice. I'm using a Apache server already configured for another webservice, I thought it would be easy to add another one, but I was absolutely wrong.</p>
  <p>The thing is configured that way :</p>
  <pre><code>Servername is www.ourcompany.com
  
  Location /WEBSERVICE/The/First/One
  
  ProxyPass http://internalserver:specificport/WEBSERVICE/The/First/One
  
  ProxyPassReverse http://internalserver:specificport/WEBSERVICE/The/First/One
  
  Location /WEBSERVICE/The/Second/One
  </code></pre>
  <p>and then... it goes wrong.
  The thing is, for the first one, we used ProxyPass because except for the servername, the path is absolutely the same.</p>
  <p>But for the second one I have some rewriting to do and I can't for the life of me figure out the correct syntax.</p>
  <p>Basically we want the user to hit</p>
  <p><code>https://www.ourcompany.com/WEBSERVICE/The/Second/One/clients/clientsIDxxxxx/something</code> which should redirect to <code>https://internalserver/clients/clientsIDxxxxx/something</code>.</p>
  <p>I tried to ProxyPass to <code>https://internalserver</code>, I tried</p>
  <pre><code>RewriteRule ^(.*)$ https://internalserver/$1
  </code></pre>
  <p>http, https, rewriterule to a specific page, only RewriteRule the clients part ( with something like <code>^/clients/(. *)$</code> ) but no success.
  I have to say regex is really obscure for me, I'm pretty sure the syntax is what's causing the issue, but I do not get it. The Apache documentation did not really help me.</p>
  <p>I have got mostly 404 error and before giving up for the day I was at the point where the redirection did something like <code>https://internalserver/WEBSERVICE/The/Second/One/clients/clientsIDxxxxx/something</code>, so I feel like I was close.</p>