I am coding on cakephp 1.3. I have a problem redirecting the page to index.html.
My index.html is inside webroot folder.
What I know cakephp will directly redirect to index.html.
When I using URL it is showing error..
Error: Controller could not be found.
Error: Create the class Controller below in file: app/controllers/controller.php
<?php
class Controller extends AppController {
var $name = '';
}
?>
I have followed some link but it not seems to work.
I have checked on Google also.
How can I append .html to all my URLs in cakephp?
You can't replace CakePHP's own index.php or CakePHP will stop working. Normally you can put files in webroot and it would work without problems, but the root file is a bit more trickier, since (AFAIK) you can't use Cake's routing only to display a non-CakePHP file.
Put your html file in a view in any controller and route the root directory there. For example, name the file index.ctp and put it in app/views/static_pages/index.ctp.
Router:
Router::connect('/', array('controller' => 'static_pages', 'action' => 'index'));
Controller (static_pages_controller.php):
class StaticPagesController extends AppController {
function index() {
// no need to do anything except use no layout file
$this->layout = false;
}
}
Model (static_page.php):
class StaticPage extends AppModel {
// don't use a database for this model
var $useTable = false;
}