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

Community guidelines

Please keep discussions civil and on-topic. Repeated violations may lead to a temporary ban.

General

Restrict admin access to defined IP addresses

admin

Started by Alan Coggins 4 years ago · 0 replies · 645 views
4 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 Jerry Hunt, 4 days ago
2 80 10 hours ago
General · by pamtbaau, 15 hours ago
1 51 15 hours ago
General · by Andy Miller, 1 day ago
0 45 1 day ago
General · by Marcel, 12 months ago
6 346 5 days ago
General · by Duc , 5 days ago
3 40 5 days ago