IP domain name conflicts

Keywords: WordPress - Google Cloud Platform - How to - Application configuration

Description:
Hi,

Foremost, please pardon me for not using the right technical jargon to explain the situation.

I have issues with IP and domain name conflicts in server configuration.

Below lists some of the problems:

  1. Google Search has cached the server’s external IP instead of the domain name
  2. Google Merchant Center reported errors of url contains IP instead of domain name
  3. Some theme/plugins point to the server’s external IP instead of the domain name

What I have done to change IP to domain name:

  1. I have used plugins such as Better, Search Replace and String locator to change all IP to domain.

  2. In the database, I have updated the siteurl and home to example.com

sudo mysql -u bn_wordpress -p -e "USE bitnami_wordpress; UPDATE wp_options SET option_value='http://example.com' WHERE option_name='siteurl' OR option_name='home';"

I’ve confirmed that the website URL is correctly updated from Admin Panel > Settings > General It shows http://example.com.

  1. I updated the wp-config.php from
define('WP_SITEURL', 'http://' . $_SERVER['HTTP_HOST'] . '/');
define('WP_HOME', 'http://' . $_SERVER['HTTP_HOST'] . '/');

to

define('WP_SITEURL', 'http://example.com/');
define('WP_HOME', 'http://example.com/');

Step 3 ultimately breaks the website. The site breaks once the wp-config.php is updated.


Some additional info:

  • The web server is attached to a load balancer
  • Using load balancer to handle HTTPs. There is no SSL installed on the server level.
  • The domain name is fully resolved.
  • There is no issue with the website’s functionality other than the IP/domain name conflicts

Thanks

Hi @FZC,

Let me give you some thoughts about the issues you might be running into:

  • If you are using https in the Load Balancer, you should use https when setting the domain in the wp-config.php file.
  • Please confirm if Apache is generating any redirection response when the load balancer access the information of the instance. If Apache generates any redirection, it may end up in a redirection loop.
  • There is also a plugin that helps you modify the database information

https://wordpress.org/plugins/better-search-replace/

You can contact Google to update that information and use the domain instead of the IP address.

Thanks @jota

  • I’ve tried with https://example.com, it breaks the site too.
  • I have used your recommended plugin to replace all IP with the domain name.
  • Where should I look into to check if Apache is generating any redirection response?
    Here is the /opt/bitnami/apache/conf/bitnami/bitnami.conf
# Default Virtual Host configuration.

# Let Apache know we're behind a SSL reverse proxy
SetEnvIf X-Forwarded-Proto https HTTPS=on

<VirtualHost _default_:80>
  DocumentRoot "/opt/bitnami/apache/htdocs"
  <Directory "/opt/bitnami/apache/htdocs">
    Options Indexes FollowSymLinks
    AllowOverride All
    Require all granted
  </Directory>

  # Error Documents
  ErrorDocument 503 /503.html
</VirtualHost>

Include "/opt/bitnami/apache/conf/bitnami/bitnami-ssl.conf"
  • For Google’s cached, is it because of the server configuration that resulted the server’s external IP being cached instead of the domain name?

Just to add, the website is functioning properly with the load balancer. The problem is the IP/domain name configuration conflicts. Other than the Google’s cached, some theme/plugins retrieve/use the VM’s external IP instead of the resolved domain name too. Hence, I assumed the server is not correctly setup.

If you do no have any redirection loop right now, there shouldn’t be any problem. However, you should also add that SetEnvIf line to the WordPress’ conf files inside the /opt/bitnami/apache2/conf/vhosts folder.

I suggest you contact Google or WordPress to know how to update that information and how the app is generating the information for Google to retrieve it.

In this case, you should contact the developers of those plugins/themes to know from where they are getting the IP/domain information.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.