Yii 1.1: seourlmanager

SEO friendly URLs

Development of seoUrlManager has been DISCONTINUED. There will be no future updates, bug fixes or support.

seoUrlManager is a Yii Framework Extension that extends CUrlManager to make your web application URLs more SEO friendly.


  • No duplicate content with help of 301 redirects
    • Add/strip www in URL
    • Remove entry script from URL
    • Add trailing slash to URL
    • Remove multiple slashes in URL
    • Remove Query String from URL
  • Create unique URLs
  • Automatically configure certain settings of urlManager


  • Yii 1.1.8+ (might work on lower versions, not tested)


1: Extract and copy the seoUrlManager folder into your Yii extensions folder
2: In your main Yii configuration file define the class for the urlManager Component

return array(

4: Create a file called .htaccess in the same folder as your Yii Entry Script file (index.php) with following content. Adjust filenames as necessary.

RewriteEngine on

# if a directory or a file exists, use it directly
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d

# otherwise forward it to index.php
RewriteRule . index.php


If you are updating to a new version, delete the seoUrlManager folder inside your extensions folder and repeat steps 1-2 from the installation instructions above.


You can basically use the same configuration options that are available in CUrlManager, but most of them will be overwritten or extended by seoUrlManager (useStrictParsing, urlFormat, showScriptName, urlSuffix, caseSensitive, appendParams). Following is a list with new settings that are added by seoUrlManager.

  • wwwMode
    • Define if www should be stripped or added to URL. Deactivate by setting it to false.
    • Available options: 'add', 'strip', false
    • Default: 'add'

Please note that either the rules or the urlRuleClass setting is required for seoUrlManager to work. More info on these two settings can be found here. If you plan on using Gii you will need to add rules as defined here.

Configuration sample:

return array(


seoUrlManager does not need any user interaction since everything runs automatically. It is actually a more restricted version of the standard urlManager so expect it not to have certain flexibility since its goal is to create unique and simple URLs in a specific format.


  • 1.0.1
    • Fail silently if URL cannot be parsed
    • Adjust error messages and logging parameters
    • Adjust property/method visibility to allow class extensions
  • 1.0
    • Initial release

Total 5 comments

#19201 report it
nywuctuk at 2015/04/14 09:52pm
wrong redirect from all pages to http://site.ru/index.php

need change from 67: $this->_path = (!empty($urlParts['path'])) ? $urlParts['path'] : ''; to 67:$this->_path = Yii::app()->request->requestUri;

#4887 report it
limitless at 2011/08/25 09:48am
Re: Query String

it kinda defeats the purpose of the extension to globally allow query string... so i decided to not implement anything in that direction as of right now... maybe later... right now i will keep that up to individual needs so that if you need query strings you should be able to easily extend ExtSeoUrlManager class on your own...

if u come up with a good idea where query strings are not globally activated let me know please...

#4882 report it
zeckon at 2011/08/24 06:23pm
Query String

Hello again, I considered converting ajax gets to posts but there are many 3rd party plugins so it isn't feasible for us, and also there will be extra future work for new plug-ins.

Actually my current solution is, adding $urlParts['query'] to _connectUrlParts return if query is not empty. It seems to work for me but not sure if it's a complete solution.

#4881 report it
limitless at 2011/08/24 03:29pm
re: Removing Query String

Hey zeckon

Thanks for your feedback...

you might be right... one possible solution is to use POST instead of GET. you can define that with the type option in jquery's ajax method.

if you have a sexy solution that comes to your mind just let me know and i will see if i can implement it...

#4880 report it
zeckon at 2011/08/24 01:40pm
Removing Query String

Thanks for the extension, however I encountered a problem, I think removing query string breaks jquery ajax gets.

Leave a comment

Please to leave your comment.

Create extension