Click to See Complete Forum and Search --> : Can I still use .htaccess to set up password proection folder for MVC system?


blackhorse
06-09-2009, 07:19 PM
I am thinking about doing it this way.

create sub folders like

application/controllers/admin
application/views/admin

So when in the url to access admin pages it is

http://www.mysite.com/admin

But in MVC, there is no folder /home/www/admin actually. I cannot add save a .htaccess in /home/www/admin

So in the root folder, I save the .htaccess with

<Directory /home/www/admin>
AuthType Basic
AuthName “admin”
AuthUserFile “/home/.htpasswds/passwd”
require valid-user
</Directory>

The codes seems right. But I got internal error of the server. If I remove the <directory> tag. the .htaccess works but of course blocks the whole site instead of /home/www/admin, url I told it to block in directory tags.

Is that the right way to do the .htaccess password protection in MVC framework like CI?

Is my script right but it is a server issue?

Thanks!