Limiting (or restricting access to) login page to only 1 or 2 IPs

Permalink 1 user found helpful
Hello,

I am trying to restrict access to the login.php page to 1 or 2 IPs.

I have the following placed in a .htaccess file inside of the folders single_pages, controllers, concrete/single_pages, concrete/controllers but it doesn't seem to work.

<Files login.php>
Order Deny,Allow
Deny from all
Allow from 74.87.190.242
<Files>

All users can still get to the login page here:http://demo.parson.me/index.php/login... so it isn't working.

Any ideas on what I am doing wrong?

 
excelc replied on at Permalink Reply
Do anyone happen to have a test installation that they could try my above code on? I haven't had any luck with it yet.

I also saw this:http://www.concrete5.org/community/forums/customizing_c5/can-i-chan... and tried that code and it didn't seem to do anything. I can still get to the login screen so maybe something in the newer version of Concrete5 (I have the latest) is the culprit here but if someone else has luck then I will know that the issue is on my end at least.

The one I linked to seems more promising (probably the better way to do it) if someone wants to try that code and let me know if it works for them.
CMSDeveloper replied on at Permalink Best Answer Reply
CMSDeveloper
Hello,

Must be something like:

<?php
$myip = "Your IP1" | "Your IP2"; 
$location = "location where ever u want to redirect"; 
if($_SERVER['REMOTE_ADDR'] != $myip) 
{ 
header("Location: $location"); 
} 
else 
{ 
//it's me let me pass in 
}  
?>


Copy:
/concrete/single_pages/login.php
to:
/single_pages/login.php

and add above code.

.