Andrei Andrei - 1 month ago 9
Apache Configuration Question

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 all from all it can be accessible but I want it to only be accessible to my computer

Answer

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