I'm following the quickstart guide for Lithium: http://li3.me/docs/manual/quickstart
I created my posts Model in /var/www/my_app/app/models/Posts.php
<?php
namespace app\models;
class Posts extends \lithium\data\Model {
}
?>
I created my posts Controller in /var/www/my_app/app/controllers/PostsController.php
<?php
namespace app\controllers;
class PostsController extends \lithium\action\Controller {
public function index() {
return array('foo' => 'bar', 'title' => 'Posts');
}
}
?>
And I created my View in /var/www/my_app/app/views/posts/index.html.php
Lithium is less dense than <?=$foo;?>ium.
The quickstart guide then says that I should be able to view my posts index page by going to
http://localhost/my_app/posts
but I get a
Not Found
The requested URL /my_app/posts was not found on this server.
However, if I go to just
http://localhost/my_app
the default home page that comes with Lithium is displayed.
So I tried fixing the problem by adding this line to my /var/www/my_app/config/routes.php file:
Router::connect('/posts', 'Posts::index');
But I get the same Not Found error?
You need to make sure that mod_rewrite
is installed and enabled in your Apache.
Also check that the .htaccess
file is present and allow_override
is properly set for the virtualHost, otherwise .htaccess
files will be ignored.
For further information, check the troubleshooting section in the documentation