Difference between #1 and #3 of
Changing Controllers Name

Changes

Title unchanged

Changing Controllers Name

Category unchanged

How-tos

Yii version unchanged

Tags unchanged

newbie, controllers

Content changed

[...]
If you are using standard (autogenerated) configuration file, there are some default URL-rewriting rules and application and/or module can be accessed via URLs like these:


```php
http://{server_address}/{application_path}/site/index.html
http://{server_address}/{application_path}/{
controller_imoduleId}/default/index.html
```
[...]
If you wish to change not only URLs (which can be done with URL Management --> see [here](http://www.yiiframework.com/doc/guide/1.1/en/topics.url "URL Management")), but also controllers names (for example for some files and folders structure cleanup or for satisfying defined name nomenclature), you will have to undertakes theses four steps:

1. Change controller's file name, for example from _SiteController.php_ to _MainController.php
_". 2. Edit this controller file and change class name, in the first code line, for example from _SiteController_ to _MainController_" (see end of this chapter).
3. Change views folder name, for example from _protected/views/site_ to _protected/views/main_.
4. If this is main (default, major) controller, edit application configuration file and inform Yii about change in application or module default controller name.

For application:
[...]
4 0
2 followers
Viewed: 26 547 times
Version: 1.1
Category: How-tos
Written by: Trejder
Last updated by: Trejder
Created on: Dec 9, 2010
Last updated: 10 years ago
Update Article

Revisions

View all history