Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

server-status in wordpress htaccess

I want to enable server-status from mod_status

I have this on .htaccess file

# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_URI} !=/server-status
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>

httpd.conf is

<Location /server-status>
    SetHandler server-status
    Order Allow,Deny
    Deny from all
    Allow from 111.11.1.1
</Location>

I'm using my external IP. I'm using this website to know my IP address. https://www.whatismyip.com/

But when I access example.com/server-status it's a 403 forbidden but then when I change the http conf to allow from all it can be accessed but I want it to only be accessible to my computer

like image 794
Andrei Avatar asked Nov 27 '25 17:11

Andrei


1 Answers

Directive Order can be tricky, maybe that's the reason why it is deprecated.

Nevertheless, when you want to use it, just go by the examples in the documentation

In the following example, all hosts in the example.org domain are allowed access; all other hosts are denied access.

 Order Deny,Allow  
 Deny from all  
 Allow from example.org  

Do you see the different order of Deny,Allow?


To use the current Require directive, this should work

Require ip 111.11.1.1
like image 192
Olaf Dietsche Avatar answered Nov 30 '25 12:11

Olaf Dietsche



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!