title: If session or cookie is set, append query string to URLs across the whole domain
body: <p>We have a PHP app that uses dynamic branding, so if we insert the query string </p>
  
  <p><code>?dealer=the_dealer_name</code> or <code>&amp;dealer=the_dealer_name</code>, we are able to dynamically load that dealer's logo and stylesheet on our main platform without having to log in to the dealer's account (we sell the app to thousands of dealers). This works fine but the app has several pages and if we are demonstrating the app we don't want to add the query string every time we open a new page.</p>
  
  <p>So the idea is to set either a cookie or a session when the <code>$_GET['dealer']</code> is set and not empty and make the query string persistent across the whole app so we don't need to keep adding it for every page during the demos. We will put an expiration time of one hour to that cookie/session. We will also add the ability to unset them if we pass an empty string to the 'dealer' query such as <code>?dealer=</code>.</p>
  
  <p>I wanted to know if there is any way I can add the <code>?dealer=the_dealer_name</code> / <code>&amp;dealer=the_dealer_name</code> query string to the url after it is set for the first time and make it persist as the last query string of the URL until the cookie/session expires.</p>
  
  <p>To summarize, once we pass the query string <code>?dealer=the_dealer_name</code> or <code>&amp;dealer=the_dealer_name</code> to the URL, all URL paths on the site will have that query string appended, unless we pass an empty string as the parameter and unset the cookie/session, or the cookie/session expires.</p>
  
  <p>Thank you!</p>
  
  <p>P.S. getting the URL via <code>$_SERVER</code> globals, adding the query string, and redirecting using <code>header()</code> may not work because I have to put the logic in my header file. Any loaded page needs to redirect to itself but with an appended query string, which will create redirects on top of redirects.</p>