Get current URL/URI without some of $_GET variables
Yii::app()->createAbsoluteUrl(Yii::app()->request->url)
This will output something in the following format:
http://www.yoursite.com/your_yii_application/
Yii 1
Most of the other answers are wrong. The poster is asking for the url WITHOUT (some) $_GET-parameters.
Here is a complete breakdown (creating url for the currently active controller, modules or not):
// without $_GET-parametersYii::app()->controller->createUrl(Yii::app()->controller->action->id);// with $_GET-parameters, HAVING ONLY supplied keysYii::app()->controller->createUrl(Yii::app()->controller->action->id, array_intersect_key($_GET, array_flip(['id']))); // include 'id'// with all $_GET-parameters, EXCEPT supplied keysYii::app()->controller->createUrl(Yii::app()->controller->action->id, array_diff_key($_GET, array_flip(['lg']))); // exclude 'lg'// with ALL $_GET-parameters (as mensioned in other answers)Yii::app()->controller->createUrl(Yii::app()->controller->action->id, $_GET);Yii::app()->request->url;
When you don't have the same active controller, you have to specify the full path like this:
Yii::app()->createUrl('/controller/action');Yii::app()->createUrl('/module/controller/action');
Check out the Yii guide for building url's in general: http://www.yiiframework.com/doc/guide/1.1/en/topics.url#creating-urls