Automatically Redirect To Rewritten Url

I use a lot of URL rewrites in my App, but in some locations, like javascript files, I have to hardcode the original non-rewritten URL. I was wondering if there was an easy way to make Yii redirect to a rewritten URL automatically.

For example, if I enter the site using www.site.com/shop/list/id/123, it should automatically redirects itself to:www.site.com/overview/123

Many sites already use this, for example if you go to:


http://stackoverflow.com/questions/1673841

it will redirect itself to:


http://stackoverflow.com/questions/1673841/examples-of-gof-design-patterns

This is better for the user, and it forces search-engines to index the right URL.

Any thoughts on this?

Take a look at this wiki.

Thanks, looks like that’s what I need