title: Redirection based on IP doesn't work anymore, maybe something hostname based instead?
body: <p>I have a question; I have been using the two examples below for ages so it always points me to my correct script. For example Sabnzbd and Sonarr.</p>
  
  <p>However out of the blue, my home ISP decided to change my IP on (almost) a daily base. Also not just the last range of the IP, but also the number in front. This makes adapting my script kinda pointless and now I wondering if there is a way to make use of the hostname instead.</p>
  
  <p>I only use this "script" at 2 important locations. The rest is not important. The home provider has "caiway.nl" in the hostname and at the other location it has "ziggo.nl" in the end of the hostname.</p>
  
  <p>I use several scripts to redirect me to the right location, however the ones below are examples. Maybe someone has an idea or workaround for this issue once and for all.</p>
  
  <pre><code>&lt;?php
  // Sabnzbd
  $visitor = $_SERVER['REMOTE_ADDR'];
  if (preg_match("/62.45.*.*/",$visitor)) {
        header('Location: http://192.168.1.55:9900');
  } else {
        header('Location: http://place.dnsforwarder.eu:9900/');
  };
  ?&gt;
  
  &lt;?php
  // Sonarr
  $visitor = $_SERVER['REMOTE_ADDR'];
  if (preg_match("/62.45.*.*/",$visitor)) {
        header('Location: http://192.168.1.55:3300');
  } else {
        header('Location: http://place.dnsforwarder.eu:3300/');
  };
  ?&gt;
  </code></pre>
  
  <p>So instead of something IP-based, I want to make use of the hostname instead, so it doesn't matter what IP am given at any day.</p>
  
  <p>I already thought of switching it around, however at the other place my IP also changes frequently. Sigh.</p>
  
  <p>I hope someone understand what I mean and can come up with some kind of workable solution and/or example to use with the above.... Thanks.</p>
  
  <p>[edit/update/more info]</p>
  
  <p>Apparently it's not very clear. I use the above code on a personal starting (web)page. So I can click on those 2 links and it will redirect to my local IP and port number, otherwise it will a dynamic dns service (afraid.org) to redirect me correctly. In this case it's "place.dnsforwarder.eu" as a dns forward (hence the name obviously).</p>
  
  <p>However, as explained, both ISP's (different ones) are changing my IP number on a daily basis. So the code doesn't work anymore as it should (on 1 location at least). Now instead of some kind of IP check, I want to know if it's possible to use something hostname based instead (based on my 2 ISP's; ziggo.nl or caiway.nl). That way it doesn't matter if they would change my IP every minute, I would always get forwarded to the right place.</p>
  
  <p>Sidenote; I could ofcourse create 2 different starting pages, one for each location, however that brings a ton of work along and more importantly; it wouldn't work correctly because browsers are in sync nowadays and it would mean I would have to change my starting page (1 or 2) everytime I go to one of the 2 locations... </p>