CMS - User Defined URL's


I have a custom CMS I built using php with classes and functions, but it is not MVC. I am going to try to re-create it in Yii.

I want to be able to have the user create their own url’s so in the old code I had something like this (more complex, but this gets the point across)


RewriteEngine on

RewriteCond %{REQUEST_FILENAME} -f [NC,OR] 

RewriteCond %{REQUEST_FILENAME} -d [NC] 

RewriteRule .* - [L]

RewriteRule ^site/cache/([0-9]+)/(.*)$ /site/assets/phmagick/?width=$1&resizeFile=$2 [L]

RewriteRule ^(.*)$ /site/content.php?permalink=$1 [L]

Then the index.php file basically did

select from DB where permalink=’$permalink’

if result create page, else deliver 404 page.

The CMS also had modules (calendar, press releases, and others)

The modules where all under /site/


so my htaccess rule that routed everything to index.php was ingnored as the URL was to a valid file.

How can I achieve the same in Yii. Basically if they go to /site/calendar it checks for a Yii controller (calendar) if it is not existent it passes (site/calendar) to a "pages" controller…

Is this possible?

This is my first try at MVC and I figure it would be good to do a real world project, one that I will use, and more importantly one that i have already created, so I know exactly what I want to achieve…

I think that the best for you is to leave this special url for last.

Such custom approach to url is not supported by CurlManager, you have to rewrite some functions (createUrl and parseUrl) in this class.