title: WordPress redirect from IP to domain name
body: <p>Trying to understand exactly how WordPress works from the perspective of what is set for the <code>WordPress Address (URL)</code> and <code>Site Address (URL)</code> settings under <code>Settings -&gt; General</code> in the admin GUI.</p>
  
  <p>I have a fresh install of <code>WordPress 4.7.1</code> on an internal environment with the dedicated IP of <code>10.1.245.106</code></p>
  
  <p>For the <code>WordPress Address (URL)</code> and <code>Site Address (URL)</code> settings under <code>Settings -&gt; General</code> in the admin GUI, I have them both set to <code>http://www.example.com</code></p>
  
  <p>Under <code>Settings -&gt; Permalinks</code>, I have it set to <code>Post name</code></p>
  
  <p>The active theme is <code>Twenty Seventeen</code></p>
  
  <p>In the local host file on my machine, I have the following set.</p>
  
  <pre><code>10.1.245.106 example.com
  10.1.245.106 www.example.com
  </code></pre>
  
  <p>The <code>.htaccess</code> file looks like this...</p>
  
  <pre><code># BEGIN WordPress
  &lt;IfModule mod_rewrite.c&gt;
  RewriteEngine On
  RewriteBase /
  RewriteRule ^index\.php$ - [L]
  RewriteCond %{REQUEST_FILENAME} !-f
  RewriteCond %{REQUEST_FILENAME} !-d
  RewriteRule . /index.php [L]
  &lt;/IfModule&gt;
  # END WordPress
  </code></pre>
  
  <p>When I type <code>10.1.245.106</code> into my web browser and hit enter, I am taken to <code>http://10.1.245.106</code></p>
  
  <p>I was under the impression that WordPress would use whatever is set in the <code>Site Address (URL)</code> setting, and a redirect would take place and take me to <code>http://www.example.com</code>.</p>
  
  <p>I actually thought I remember another one of my sites working like that, so I started digging into why it wasn't happening on this new site I was messing around with.</p>
  
  <p>I tried installing a couple different themes from the WordPress themes repository, but that didn't make the redirect work as I was expecting.</p>
  
  <p>I decided to install and active the <code>Enfold</code> theme, which is the theme that is currently active on the site that I remember redirecting from the IP to the domain name.</p>
  
  <p>Sure enough, after installing and activating the <code>Enfold</code> theme, then typing <code>10.1.245.106</code> into my web browser and hitting enter, I am taken to <code>http://www.example.com</code></p>
  
  <p>I even went into the database and changed the values for the <code>WordPress Address (URL)</code> and <code>Site Address (URL)</code> settings to <code>http://www.exampleblahblahblah.com</code>, then typed <code>10.1.245.106</code> into my web browser and hit enter. Sure enough, I was redirected to <code>http://www.exampleblahblahblah.com</code>. Nothing rendered though, because I don't have an entry in my local host file for that domain name.</p>
  
  <p>I dug through the <code>Enfold</code> theme and see nothing in the theme code that would be doing this redirect!</p>
  
  <p>Am I right in saying that WordPress core DOES NOT do the redirect from IP to domain name that is set in the <code>Site Address (URL)</code> setting?</p>
  
  <p>And since I can't find anything in the <code>Enfold</code> theme that is doing this redirect, does anyone have any idea how it would be happening when the <code>Enfold</code> theme is active, but not when any of the core WordPress themes that are available in the WordPress theme repository are active?</p>