I want to run my activeIndex() function in GuestsController.php file under a subdirectory as the first default page when the user enters the url.
For this reason, I have written such a script in my .htaccess file:
RewriteEngine On
RewriteCond %{REQUEST_URI} !^/controllers/GuestsController.php/.*
RewriteRule ^/mvc/(.*) /controllers/GuestsController.php?method=$actionList?page=$1 [QSA,L]
And my GuestsController.php file is:
<?php
class GuestsController
{
public function actionIndex()
{
echo "start";
sleep(1);
include(dirname(__FILE__) . '/../views/guests/index.php' );
}
public function actionList()
{
$guests = Guests::findAll();
echo json_encode( $guests );
}
}
I still could not manage to achieve my goal.
How I should modify .htaccess file to run actionIndex() function directly?
Thanks,