Webpages located under app/webroot aren't subject to processing the same 
way that controllers are.

If you have static pages that require authentication, then I would suggest 
usage of the Pages controller 
(http://book.cakephp.org/2.0/en/controllers/pages-controller.html), and 
relocate those static pages under app/Views/Pages. You'll probably also 
need to update the extensions from .htm(l) to .ctp, and make use of the 
Router to allow the .htm(l) extension.

Regards
Reuben Helms

On Thursday, 15 May 2014 18:38:40 UTC+10, Sam wrote:
>
> I am using cakephp 2.4.5. I would like to redirect all users who have not 
> logged in to a login page. I basically followed the instructions here 
> http://miftyisbored.com/a-complete-login-and-authentication-application-tutorial-for-cakephp-2-3/
>
> In summary, the important part is the following code to AppController.php
>
> public $components = array('Session',
>                             'Auth' => array(
>                                 'loginRedirect' => array('controller' => 
> 'users', 'action' => 'index'),
>                                 'logoutRedirect' => array('controller' => 
> 'users', 'action' => 'login'),
>                                 'authError' => 'You must be logged in to view 
> this page.',
>                                 'loginError' => 'Invalid Username or Password 
> entered, please try again.'        
>                             ));
>
> Any websites with this URL format http://localhost/cakephp245/controllers/XXX 
> will be re-directed to the login page. However, websites that are located 
> inside webroot with URL that looks like 
> thishttp://localhost/cakephp245/app/webroot/XXX will not be re-directed to 
> the login page.
>
> How can I force websites located inside app/webroot folder to be re-directed 
> to the login page?
>
> Thank you very much.
>
>

-- 
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP

--- 
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/cake-php.
For more options, visit https://groups.google.com/d/optout.

Reply via email to