0
votes

I've having a bit of trouble with cakephp and custom htaccess file.

I have a site built in cakePHP. However i'm now trying to complete an admin area to the site and all the admin pages are in another folder, i am then trying to add a htaccess file to this folder. However it fails to work. I've done some htaccess on similar shared servers before, including my own personal one which is the same. I've added the one i'm trying to create onto my person server and works correctly.

So i'm guessing cakePHP is prehaps stopping/overriding this htaccess from running.

Any ideas? * is the server name - i have of course got the login/pass correctly in the htpasswd2

AuthUserFile /home/*/.htpasswds/.htpasswd2 AuthType Basic AuthName "Hmm. Your not going anywhere without a password!" Require valid-user

1

1 Answers

0
votes

You should use prefix routing. This is the Cake way.

Configure::write('Routing.prefixes', array('admin'));
Router::connect('/admin', array('controller' => 'pages', 'action' => 'index', 'admin' => true));

Which may be enabled already and it is causing problems with the admin folder that you created.

Using prefixes keeps the Cake convention. But you won't be able to protect that folder with htaccess, because it is not really a folder. If this admin area is meant to manage a webapp built in CakePHP, I suggest you to keep the Cake way.