![]() |
How to restrict IP on folder of controllers from apache config? - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20) +--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23) +--- Thread: How to restrict IP on folder of controllers from apache config? (/showthread.php?tid=56257) |
How to restrict IP on folder of controllers from apache config? - El Forum - 12-05-2012 [eluser]gwerner[/eluser] I'd like to restrict access to a folder of controllers that are used for admin purposes only. I've tried a number of ways and not coming up with a solution. These controllers are behind password protection. But, I'd like to just remove it from view if someone happens to stumble upon the right directory. Can this be done? I'd rather not do it from htaccess. I have access to the apache config files, so I'd like to handle it there. Does it have anything to do with the way Codeigniter routes? Or, am I just way off? This what I'm using that doesn't work Code: <Directory /var/www/application/controllers/folder/> How to restrict IP on folder of controllers from apache config? - El Forum - 12-05-2012 [eluser]gwerner[/eluser] This is something I've found while searching the googlenet. This doesn't seem to be the best option. But the only path I've discovered that may work. Thoughts? Code: $your_ip_address='123.123.123.123'; //change it to yours How to restrict IP on folder of controllers from apache config? - El Forum - 12-05-2012 [eluser]CroNiX[/eluser] If you want to restrict access to a dir by IP via apache, you just need to add an additional line(s) after your "Deny from all", like: Order Deny,Allow [this says, first I'll tell you to do deny, then I'll tell you who to allow] Deny from All [You are denying everybody] Allow from 123.123.123.123 [except this IP] Allow from 234.234.243.234 [and this IP] How to restrict IP on folder of controllers from apache config? - El Forum - 12-05-2012 [eluser]gwerner[/eluser] I tried that, but I wasn't having any success. The example I put in first is what I had whittled it down to try to get anything to work. This is my original original that I was tried that doesn't work. Code: <Directory /var/www/application/controllers/foldertoblock/> If I just try to block the web root this worked. Code: <Directory /var/www/> Does it not work because the Codeigniter handles everything through the index.php? |