Hiding index.php causes Pagination to fail

After reading The Definitive Guide to Yii and completing the Creating Your First Yii Application, I decided to try tackling the process of removing ‘index.php’ from my URLs. My .htaccess file is correct and I set the showScriptName to false in main.php. Now when I go to access http://localhost/~nixerpenguin/yii/testdrive/user I find that my Pagination links are broken.

The AJAX version NOR the HTML version of CListView work. Am I missing something or do I need to recreate the Model and CRUD after making this change in configuration? Logic tells me that this is a completely separate issue, however, I would have believed someone would have tackled this problem by now. Thank you in advanced for your help.

You don’t need to recreate the Models and CRUD…

What are the links of the paginations?

what are the settings for the urlManager?

The links of pagination are:




http://localhost/~crhodes/testdrive/user/index?%2Fuser%2F=&User_page=2

http://localhost/~crhodes/testdrive/user/index?%2Fuser%2F=&User_page=3



The settings for the urlManager are:




        'urlManager'=>array(

            'urlFormat'=>'path',

            'showScriptName'=>false,

            'rules'=>array(

                '<controller:\w+>/<id:\d+>'=>'<controller>/view',

                '<controller:\w+>/<action:\w+>/<id:\d+>'=>'<controller>/<action>',

                '<controller:\w+>/<action:\w+>'=>'<controller>/<action>',

            ),



It appears the URLs are being created in GET instead of PATH format. I looked through the documentation to change this, but turned up zero so far. In my planned application I want all of my URLs to be in the PATH format.

Thank you for the help!

Are you hardcoding the links?

O are you using the createUrl() method?

cause if you are hardocodign the links, then is dificult that works…

But if you let the aplication make the urls for you (using the createUrl() method, defined in CController) then this always works, no matter if you use PATH format or not…

Do you have a rule for the <controller>/index ?

I am using the yiic shell to create the User model and the CRUD as explained in the tutorial (see original post). Aside from the tutorial I have only modified protected/config/main.php under urlManager for showScriptName=>false and added a .htaccess file.

The rules I have for the urlManager are listed in my original response.