Controller And Action Name Alias

Hi,

I’ve been searching for a while now, but maybe using the wrong keywords?

I’m looking for a simple solution to translate the english names of my controllers and actions.

I got:

www.website.com/controllername/action/id/

I want:

www.website.com/controllername/action/1/ AND

www.website.com/blabla/act/1/

to work the same.

So I can use URL’s in the language of the website.

Simply put these hardcoded aliases in the rules section of urlManager in the main config won’t work…

It must be a simple thing, but I can’t find it :-[

Tnx a bunch!

Or should i just use the .htaccess rewriterules for this (like I use to do before I used Yii) ???

its depends totally on your code to use htaccess or URLManager.

1.) URLManager is the best way to do this as it handles both the way parsing inconing urls and converting them also.

but to use URLManager you have to specifically need to use createURL while writing any url in the application

2)if you have not used CreateURl function to write urls, you have to use .htaccess to rewrite urls and also manually rewrite urls into application also

Rewrite url from "blabla/act/<id:\d+>/" to "controllername/action/<id>"

Tnx for the response. So I understand that something like this can’t work:




...

		'urlManager'=>array(

			'urlFormat'=>'path',

			'showScriptName'=>false,		

			'rules'=>array(

				'bloogoos/lees/<id>' => 'blogs/view/<id>',

				'bloogoos/'=>'blogs/',

				'stukjes/lees/<id>' => 'articles/view/<id>',

				'stukjes/'=>'articles/',

...



And my .htaccess is btw as simple as this:


RewriteEngine on


RewriteCond %{REQUEST_FILENAME} !-f

RewriteCond %{REQUEST_FILENAME} !-d


RewriteRule . index.php

For the record, I manage to create the rules for use of a URL like this:

www.website.com/blooogs/lees_meer/21/title-of-the-blog.html

With the rule:




	'urlManager'=>array(

		'urlFormat'=>'path',

		'showScriptName'=>false,

                'urlSuffix' => '.html',

		'rules'=>array(

			'blooogs/'=> 'blogs/',

			'blooogs/lees_meer/<id:\d+>/<slug:[a-zA-Z0-9-]+>'=> 'blogs/view/',	



Works great.

Just another day in Yii paradise :D