I followed the book closely, but it just isn’t working. Looks like the only rule that is ever applied in Apache is
RewriteRule . index.php
My project directory is as follows (I’m using XAMPP): C:\xampp\htdocs\ppwk\
Here are the changes that I made inside:
protected/controllers/WebsiteController.php
class WebsiteController extends CController
{
public function actionIndex()
{
echo 'index';
}
public function actionPage($alias)
{
echo "page is $alias";
}
}
protected/config/main.php
'urlManager'=>array(
'urlFormat'=>'path',
'rules'=>array(
'home'=>'website/index',
'<alias:about>'=>'website/page',
'page/<alias>'=>'website/page',
),
),
htdocs/ppwk/.htaccess
Options +FollowSymLinks
IndexIgnore */*
RewriteEngine on
#if a dir or file exists, use it directly
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
#otherwise forward it to index.php
RewriteRule . index.php
I guess the problem is in htaccess file, can someone tell me what the problem is?
Thanks.