Welcome Guest, Not a member yet? Register   Sign In
is folder / path password protecion with htaccess possible in CI?
#1

[eluser]stef25[/eluser]
ive built a small custom cms that requires just one "admin" login. outside of CI i usually do this with htaccess folder password protection in cpanel, which saves alot of time. id rather not write an entire user authentication setup for just one user.

is there a way to use htaccess pword protection on a CI url? it doesnt really matter what the (rewritten) path is. currently the admin section without login is at example.com/index.php/admin/

EDIT: since the usual controller methods still need to work in /admin/ i guess the best course of action is to have a login path / folder created (via routing.php ?) that's protected, from where the admin is redirected to the "real" CI admin. am i on the right track?

thanks
stef
#2

[eluser]JoostV[/eluser]
Hi Stef,

Quick and extremely dirty hack:
-create the folder you need
-password protect it
-place an CI index.php file into it
-adjust the application and system path in that index.php so they point to your existing CI installation
-adjust the password .htaccess so it does url rewriting as well
-you're good to go

Although, it would be worth the time to implement an (existing) auth system in your CI app, that you can use over and over again. It will make your app so much more scalable.

EDIT: Forget that. Just create a folder and protect it with htacess. Then create a controller with the same name as taht folder. That's it.




Theme © iAndrew 2016 - Forum software by © MyBB