[solved]Friendly urls

I tried to do a couple of rewrite rules, But for some reason even if they do work the system cannot find them.

for example if i have the following path: index.php/site.index that loads the controller indexcontroller.php inside the protected/controllers/site directory. i wrote a rule to have path-to-site/index.html to redirect to index.php/site.$1 for some reason it shows an error "controller index.html does not exists" is that because it has a dot (.) in it? and therefor refers to Yii as a directory separator?

Thanks.

Try to write in your config something  like this:



'urlManager'=>array(


			'urlFormat'=>'path',


			'showScriptName' => false,


			'urlSuffix' => '.html',


/* your code for rules */


),


That works fine for me.

Thanks that worked. Tough when i disable the rewrite rules it doesn't seem to work. Do i need to live the htaccess rules in order for those settings above to take affect?

The default .htaccess should work fine.

Here is an example, that is written in Definitive guide:



Options +FollowSymLinks


IndexIgnore */*


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


But If you wish, you can create your own rewrite rules. As for me, I don't think it is needed.

urlManager rules define Yii behavior. You can look at blog example. I think, it's better to build your application in the same manner.

UPD: And please don’t forget to append to topic title “[solved]” after you finish doing this for others to see. It can be usefull to others :wink:

Yes the above did work. i guess it's ok now the way it is.

Thanks for pointing me out do the right direction.

You are welcome ;)