CodeIgniter Forums
Best way to protect admin-directory - 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: Best way to protect admin-directory (/showthread.php?tid=15381)



Best way to protect admin-directory - El Forum - 02-02-2009

[eluser]Unknown[/eluser]
Hi,

I've been using codeigniter for some weeks now, and I must say it's a really neat framework. I developed the entire frontend of my website in just about a week of time, and now it's time to dive into the backend. Yay. Before, I've always used htaccess to protect a certain admin folder, but now I don't know how to accomplish that with CI.

I've placed an admin-folder inside the controllers directory, and can easily access its controllers and fucntions. But where do i put the htaccess/htpasswd file so it applies on the admin folder?

The thing is I want to be able to access all my previously written models and libraries which are to be shared by both the frontend and the backend. Perhaps it's easier to just use a session login? But I like htaccess protection, it's so convenient... Or are there any other solutions out there?

Thanks
//


Best way to protect admin-directory - El Forum - 02-02-2009

[eluser]Armchair Samurai[/eluser]
You can't use .htaccess in this case - you'll need to either create your own auth system or use one of the libraries submitted by members. Try searching in the wiki.


Best way to protect admin-directory - El Forum - 02-03-2009

[eluser]Future Webs[/eluser]
you can make an empty admin folder in the root dir of your site and put the htaccess / password there

I thought about this yesterday and tried it and it works fine for a quick and simple way to protect a dir


Best way to protect admin-directory - El Forum - 02-04-2009

[eluser]Future Webs[/eluser]
scratch that, it dont work :-(


Best way to protect admin-directory - El Forum - 02-04-2009

[eluser]gunter[/eluser]
why doesn´t it work to put the index.php file into another folder - with the correct path variables to the rest of the installation... so you can use the htaccess file... -


Best way to protect admin-directory - El Forum - 02-11-2009

[eluser]bd3521[/eluser]
gunter .. that would work just update index.php accordingly with the correct paths