Url Manager Configuration in Yii framework

Prem Tiwari - - Yii framework

To change the URL format, we should configure the urlManager application component so that createUrl can automatically switch to the new format and the application can properly understand the new URLs. The complete URL management in yii framework for a Web application involves two aspects:

  1. When a user request comes in terms of a URL, the application needs to parse it into understandable parameters.
  2. The application needs to provide a way of creating URLs so that the created URLs can be understood by the application.


For a Yii application, these are accomplished with the help of CUrlManager.

To Hide index.php for SEO purpose

Go the root folder => protected => config => main.php

Open the main.php and replace the current code with :

Add following source codes in .htaccess

Note:Dont change .htaccess file inside protected
Note:Create .htaccess file outside protectd folder

Include .html after the page

About: Prem Tiwari

Prem Tiwari is the founder of FreeWebMentor.com and also a professional developer who has vast experience in PHP and open source technologies. Apart from this, he is a blogger by hobby and also he has been a regular speaker of WordPress sessions in various IT Companies.

Tags: ,