Skip to content
Grav 2.0 is officially stable. Read the announcement →
General

Restrict admin access to defined IP addresses

admin

Started by Alan Coggins 5 years ago · 0 replies · 761 views
5 years ago

I have a static IP and always like to lock down admin access to my own IP using htaccess. Everyone else gets a 403 page. Took a while to work out how to do this with Grav, so posting here in case others need it as well.

This needs to go after RewriteEngine On in the main htaccess file.

TXT
RewriteCond %{REQUEST_URI} ^/admin  
RewriteCond %{REMOTE_ADDR} !=aa.bb.cc.dd  
RewriteRule ^(.*)$ - [R=403,L]

You can define multiple allowed IP addresses by adding extra lines. And obviously if you have renamed the admin path in the config then use that instead.

Suggested topics

Topic Participants Replies Views Activity
General · by jean-louis67, 3 weeks ago
2 308 3 weeks ago
General · by Andy Miller, 3 weeks ago
0 310 3 weeks ago
General · by Veehem, 4 weeks ago
0 263 4 weeks ago
General · by milkboy, 4 weeks ago
0 264 4 weeks ago
General · by ian russell, 1 month ago
2 335 1 month ago