admin管理员组

文章数量:1302869

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?

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?

Share Improve this question asked Jul 17, 2018 at 20:25 rico_et22rico_et22 191 gold badge1 silver badge4 bronze badges
Add a comment  | 

7 Answers 7

Reset to default 3

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":

You can add the config below to wp-config

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

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

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

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

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

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)

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.

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;

本文标签: redirectWordpress redirecting to 127001 when accessing the site from a remote device