Url Rewriting Not Working

Hi, I am quite new to Yii!

I have a website that was not written by me.

Currently it has the following rules:

'img_thumbs/<type:>/<date:>/<fileName:>' => '/image/get',			


'<controller:\w+>/related/<relation:\w+>/<id:\d+>' => '<controller>/related',

'<controller:\w+>/<id:\d+>' => '<controller>/view',

'<controller:\w+>/<action:\w+>' => '<controller>/<action>',


'<_m>' => '/<_m>',

'<_m>/<_c>' => '/<_m>/<_c>',

'<_m>/<_c>/<_a>' => '/<_m>/<_c>/<_a>',


'<controller:\w+>' => '<controller>/index',			

I do understand only first line and I have some notion about what next three lines mean.

  1. However I do not understand why last four lines are here??? Could you give me some clues about it, please.

All this started because I wanted to rewrite url for static pages. Static pages views are place in folder views/site/pages. CViewAction is used for static pages.

I wanted www.mypage.com/site/page?view=about to be www.mypage.com/about. So I added the following line (above all other lines):

'<view:(home|about|offer|toknow|delivery|contacts|)>' => '/site/page', // /site/page?view=about -> /about

  1. At first it seemed to be working, but the problem appears that with this line when I open www.mypage.com it shows Error 404 and says that "It cannot find view index". For test I place "index.html" file into views/site/pages and it worked. So the problem is - why with the line above www.mypage.com is rendered as static file (views/site/pages/index.php) instead of calling Site controller action actionIndex() and render index file in normal way (using view views/site/index.php)?

Thank you!

remove last | (pipe) from your rule:


with this pipe the regular expression matched also empty string which occurs when you visit the site without specifying any controller/action/route/etc

about those last 4 lines - they match standard routes like [controller], [controller]/[action] and [module]/[controller]/[action]

however they should more like:

'<_m:\w+>' => '<_m>',

'<_m:\w+>/<_c:\w+>' => '<_m>/<_c>',

'<_m:\w+>/<_c:\w+>/<_a:\w+>' => '<_m>/<_c>/<_a>',

the last one (’<controller:\w+>’ => ‘<controller>/index’) is in fact not needed, because ‘index’ is default action anyway. It is also never matched because of earlier rule ‘<_m:\w+>’ => ‘<_m>’,

Exactly where could I find this particular Wephorum platform FOR yii.te.gd ? good luck