• mradm

    (@mradm)


    Hello,

    I’ve used WordPress for years now and my site has been getting some attempted brute-force attacks and other things, and I wanted to disable wp-login and wp-admin on the public host. I know how to disable direct access and everything, but I’m trying to get WordPress to recognize when the host is different so it loads files and allows logins from the new host only.

    To be more clear, I have an NGINX webserver that proxies /blog to an external server. When the blog is loaded from the NGINX proxy, wp-login and wp-admin are not accessible because that means you’re accessing the blog from the public URL.

    When you load the blog directly from it’s host (e.g. 10.0.0.1 or direct-blog-host.com), you can access wp-login and wp-admin.

    My issue is that when accessing it from 10.0.0.1, it loads all the content from mydomain.com/blog and the login just keeps redirecting to mydomain.com/blog.

    I’ve added this in the settings:

    if ($_SERVER['HTTP_HOST'] == 'direct-blog-host.com') {
    
    	define("WP_HOME",'http://direct-blog-host.com');
    	define("WP_SITEURL",'http://direct-blog-host.com');
    	define("WP_CONTENT_URL",'http://direct-blog-host/wp-content');
    	define("WP_PLUGIN_URL",'http://direct-blog-host.com/wp-content/plugins');
    	define("DOMAIN_CURRENT_SITE",'http://direct-blog-host.com');
    
    }

    This fixed the content loading issue but now the login doesn’t let me login. I can’t get past the login screen, it just returns right back to it after I press login.

  • The topic ‘External WordPress Administration’ is closed to new replies.