Add the following code in your AppController:
var $components = array('Session');
Add the following code in your AppController:
var $components = array('Session');
1. Under View > Pages create hello.ctp
2. Under Config folder open routes.php and add the following code:
Router::connect('/hello', array('controller' => 'pages', 'action' => 'display', 'hello'));
3. Now open your static page via: http://yourdomain/hello
This is recommended if you’re not going to use database in specific pages.
1. Create page view in /App/View/Pages/mypage.ctp
2. Copy the following codes to /App/Config/routes.php
Router::connect('/mypage', array('controller' => 'pages', 'action' => 'display', 'mypage''));
Note: Just make sure the name of your page view from /App/View/Pages/mypage.ctp is exactly the same name above from the code given.
Now you can call your page like this: www.yourdomain.com/mypage