Welcome Guest, Not a member yet? Register   Sign In
How to do htaccess authenticated controllers/folders?
#12

[eluser]jedd[/eluser]
Quote:As I've rewritten the site, I've come to the problem where I still want to use the htaccess authentication on the /cms/ folder, which of course doesn't really exist because they are all using the index.php as a front controller.

If you mean you want to retain the .htpasswd contents, then this is relatively straightforward - see the link I posted earlier about pulling data out of those files - I think it uses a pretty simple php crypt() type function. If this is what you mean, is it because there's a lot of effort invested in the .htpasswd file? I reckon it'd be fairly easy to migrate that data out into a DB.

I'd suggest it would be time well spent to write a new and better auth system around this, though, especially if you're happy with using DB calls (and I get the impression that you are).



Quote:Let's assume you create a folder called /cms/, inside this there is the HTAccess authentication layer.

But at the same time there is a /cms/ controller within the CI framework.

Which takes presidence?

There's no precedence here, so much as CI's index.php is fronting everything

The way htaccess works - as a component of your web server (Apache, say) - is that it blocks access at a file system level. This is simply not relevant with CI, because of this index.php routing that occurs. While your URL looks like it's a listing of subdirectories, it's in fact never getting past index.php.

I can't think of a way (which isn't to say it's impossible) of having your .ht stuff respected within a single controller, and then pulling up the usual ht authentication dialog for the user. But I don't know a lot about the inner workings of htaccess authentication - it's been a while since I've set one up, and even then it was a very simple system.


Really, as above, I think you are going to have to write a very basic authentication system within CI - it could be as simple as a single model / single db table.


Messages In This Thread
How to do htaccess authenticated controllers/folders? - by El Forum - 08-20-2009, 05:44 AM
How to do htaccess authenticated controllers/folders? - by El Forum - 08-20-2009, 06:15 AM
How to do htaccess authenticated controllers/folders? - by El Forum - 08-20-2009, 06:30 AM
How to do htaccess authenticated controllers/folders? - by El Forum - 08-20-2009, 06:58 AM
How to do htaccess authenticated controllers/folders? - by El Forum - 08-20-2009, 07:06 AM
How to do htaccess authenticated controllers/folders? - by El Forum - 08-20-2009, 07:15 AM
How to do htaccess authenticated controllers/folders? - by El Forum - 08-20-2009, 07:26 AM
How to do htaccess authenticated controllers/folders? - by El Forum - 08-20-2009, 07:29 AM
How to do htaccess authenticated controllers/folders? - by El Forum - 08-21-2009, 04:57 AM
How to do htaccess authenticated controllers/folders? - by El Forum - 08-21-2009, 05:19 AM
How to do htaccess authenticated controllers/folders? - by El Forum - 08-24-2009, 03:36 AM
How to do htaccess authenticated controllers/folders? - by El Forum - 08-24-2009, 07:57 AM
How to do htaccess authenticated controllers/folders? - by El Forum - 09-17-2009, 09:19 AM
How to do htaccess authenticated controllers/folders? - by El Forum - 09-17-2009, 09:34 AM
How to do htaccess authenticated controllers/folders? - by El Forum - 09-17-2009, 09:44 AM
How to do htaccess authenticated controllers/folders? - by El Forum - 09-17-2009, 09:48 AM
How to do htaccess authenticated controllers/folders? - by El Forum - 09-17-2009, 09:55 AM



Theme © iAndrew 2016 - Forum software by © MyBB