1

I've installed a Wordpress site on my local Apache Ubuntu 18.04 server with a fixed IP 192.168.100.150.

The website is working fine locally (localhost/wordpress), but when I try to open the site from another device (192.168.100.150/wordpress), it automatically redirects me to 127.0.0.1/wordpress and I get a "127.0.0.1/wordpress" refused to host message.

What is wrong?

7 Answers 7

2

Maybe your case was different from mine, but I want to share with you how I fixed this issue, hoping will be useful for other people.

In my case the issue was caused by All In One Wordpress Security Plugin (AIOWS), due to "IP RETRIEVAL SETTINGS" configuration.

My site is hosted on AWS, via Elastic Beanstalk environment and I have different instances under a load balancer. In this case seems the last version of this plugin is no more able to correctly detect the IP of the clients and so start blocking them by redirecting to 127.0.0.1

I fixed this issue by simply changing that configuration from "REMOTE_ADDR (Default)" to "HTTP_X_FORWARDED_FOR".

You can change this from: "WP Security" => "Settings" => "Advanced Settings": enter image description here

1

You can add the config below to wp-config

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

Or update the value in database at wp_options table. The settings of url located at siteurl and home in column option_name

0

Well, that was a problem related to my browser's cache - opening the site in incognito mode fixed the problem.

0

Actually, I deleted my browser's cookies, refreshed and it worked.

chrome://settings/?search=clear+browsing+data

0

this can be changed only on seetings---general- change the local ip adress (URL) 127.0.0.1 by the sot IP (192.16.x.x)

0

If you face this kind of issue first check the .htaccess file because there may be a redirection like

RewriteEngine On 
RewriteCond %{HTTP_USER_AGENT} ^$ [OR]
RewriteCond %{HTTP_USER_AGENT} (bot|crawl|robot)
RewriteCond %{HTTP_USER_AGENT} !(bing|Google|msn|MSR|Twitter|Yahoo) [NC]
RewriteRule ^/?.*$ "http\:\/\/127\.0\.0\.1" [R,L]

Then remove them or add # (comment the line) then open the private window and disable the cache and check Your Site. Then will be worked.

0

When using a reverse proxy, add to the nginx config:

    proxy_set_header Host $http_host; (or $host)
    proxy_set_header X-Real-IP $remote_addr;
    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.