Wordpress wp-login.php block with multiple domains

74 views Asked by At

I've had a Wordpress instance running for some time now and it works well. I blocked the wp-admin/wp-login.php url by default and redirected it to another domain using a plugin. Now I still had a few domains that I forwarded to this website.

But now the blocking of the wp-admin directory or the wp-login.php no longer works for these new domains.

I have already tried several methods with nginx, but unfortunately none of the methods lead to the desired result. I have now tried the following options

    location ~ ^/(wp-admin|wp-login\.php) {
        return 302 $scheme://orginal.domain/404$request_uri;
    }
        location ~ ^/(wp-admin|wp-login\.php) {
                valid_referers none blocked orginal.domain *.orginal.domain;
                if ($invalid_referer) {
                        return 403;
                }

global blocking

    location ~ ^/(wp-admin|wp-login\.php) {
                deny all;
                access_log off;
                log_not_found off;
  }

I've already looked to see if there's anything on the topic of WP Single Site & Multiple Domains, unfortunately I didn't find anything, all topics only relate to Multi Sites.

Server also runs with php8.2 and nginx

nginx -V
nginx version: nginx/1.24.0

I don't want the domain B/C etc. to be able to access wp-admin/wp-login.php.

0

There are 0 answers