Yii Framework Forum: [SOLVED] urlManager and modules - Yii Framework Forum

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

[SOLVED] urlManager and modules How to write a module rewite url? Rate Topic: -----

#1 User is offline   nancoder 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 21
  • Joined: 14-June 10
  • Location:Querétaro, Mx

Posted 05 July 2010 - 11:15 PM

Hi, I'm having problems when I try to access a module, can you tell me what I'm doing wrong please? My module's name is Quiz, and the controller is pollController

                        // URLs in path-format
                        'urlManager'=>array(
                                'urlFormat'=>'path',
                                'showScriptName' => FALSE,
                                'rules'=>array(
                                        'Quiz/<controller:\w+>/<action:\w+>/<id:\d+>'=>'Quiz/<controller>/<action>',
                                        '<controller:\w+>/<id:\d+>'=>'<controller>/view',
                                        '<controller:\w+>/<action:\w+>/<id:\d+>'=>'<controller>/<action>',
                                        '<controller:\w+>/<action:\w+>'=>'<controller>/<action>',

                                ),
                        ),


The problem is that I can't access to the module when is in the production server, but qhen I'm in the local server I can access without a problem.

This is the error that throws Yii

Page Not Found

Unable to resolve the request "Quiz/poll/terms".

The requested URL was not found on this server. If you entered the URL manually please check your spelling and try again.

If you think this is a server error, please contact the webmaster.
Configure your app enviroment with this Easy Enviroment Class

Follow me on Twitter | LinkedIn
0

#2 User is offline   Spyros 

  • Advanced Member
  • PipPipPip
  • Yii
  • Group: Members
  • Posts: 461
  • Joined: 14-April 09
  • Location:Athens - Greece

Posted 06 July 2010 - 12:38 AM

Check if the module in the server is saved as quiz instead of Quiz
0

#3 User is offline   nancoder 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 21
  • Joined: 14-June 10
  • Location:Querétaro, Mx

Posted 06 July 2010 - 12:42 AM

View PostSpyros, on 06 July 2010 - 12:38 AM, said:

Check if the module in the server is saved as quiz instead of Quiz


Thanks for your answer, is saved as Quiz, do I have to add a special rewrite rule to access modules like module/controller/action/params?
Configure your app enviroment with this Easy Enviroment Class

Follow me on Twitter | LinkedIn
0

#4 User is offline   zaccaria 

  • Elite Member
  • PipPipPipPipPip
  • Yii
  • Group: Members
  • Posts: 2,232
  • Joined: 04-October 09
  • Location:Moscow

Posted 06 July 2010 - 02:04 AM

nancoder, by experience if there are difference between production server and local machine is because on the local machine you have a case-insensitive file-system and on the production server case-sensitive.

So if in your code you call some model or component with the wrong name (wrong only by case) you will get an error only in production server.

The best way for fix this bug is to swich on Yii debug, so instead of the action error you will see the complete exception with the name of the class with wrong name.
1

#5 User is offline   nancoder 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 21
  • Joined: 14-June 10
  • Location:Querétaro, Mx

Posted 06 July 2010 - 02:42 AM

View Postzaccaria, on 06 July 2010 - 02:04 AM, said:

nancoder, by experience if there are difference between production server and local machine is because on the local machine you have a case-insensitive file-system and on the production server case-sensitive.

So if in your code you call some model or component with the wrong name (wrong only by case) you will get an error only in production server.

The best way for fix this bug is to swich on Yii debug, so instead of the action error you will see the complete exception with the name of the class with wrong name.


Thank You @zaccaria! Was the name of the controller, I thought it was a problem of the urlManager :P
Configure your app enviroment with this Easy Enviroment Class

Follow me on Twitter | LinkedIn
0

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users