title: Get current URL with PHP and change a part of it for a new url
body: <p>I am working on a WordPress website for a client. I want to create a switch element through a current URL change.
  For instance;</p>
  <p><a href="https://mywebsite.com/shop/CUSTOMER" rel="nofollow noreferrer">https://mywebsite.com/shop/CUSTOMER</a>
  should change to
  <a href="https://mywebsite.com/shop/OWNER" rel="nofollow noreferrer">https://mywebsite.com/shop/OWNER</a></p>
  <pre><code>  echo $ _SERVER ['REQUEST_URI']; ?&gt;
  </code></pre>
  <p>I have found a php code that provides me the URL of the current page. So if the visitor is on the /shop/customer page, I've found a way to create a shortcode and add my own string to it. But it creates a new link like; /shop/customer/owner</p>
  <p>I want to replace customer in owner, not adding owner to the current link. Because it has to be a dynamic solution. For example, if the visitor is on <a href="https://mywebsite.com/shoppingcart/customer" rel="nofollow noreferrer">https://mywebsite.com/shoppingcart/customer</a>, they should change this to <a href="https://mywebsite.com/shoppingcart/owner" rel="nofollow noreferrer">https://mywebsite.com/shoppingcart/owner</a></p>
  <p>Sorry for the bad english, hope you understand what i need.</p>
  <p>Regards,
  Rick</p>