Url Rewriting

Hi All,

I am new to YII Framework and i want to show only domain name in URL not the whole URL with controller name and action name.

Currently i am getting the url in following format:-

http://www.testdomain.com/application name/controller name/action name

[b]but i want to show it like this only:-

            http://www.testdomain.com/application name/


                                or


            http://www.testdomain.com/[/b]

Controller name and Action name should not be display.

Can any one help me on this?

Thanks!!!

You are talking about the urlManager see

http://www.yiiframework.com/doc/guide/topics.url

nz

Yes, I am talking about UrlManager.

I am using it that’s why i am getting the URL in the format like http://www.testdomain.com/applicationname/controllername/actionname instead of getting http://www.testdomain.com/applicationname/index.php?r=controllername/actionname in this format.

I am able to modify and hiding index.php from URL but i just want to show url in the following format:-

http://www.testdomain.com/applicationname

or

http://www.testdomain.com

I know that it’s something related to .htaccess file but i am not getting the right solution for this.

Please help me on this.

Thanks!!!

Yes, I am talking about UrlManager.

I am using it that’s why i am getting the URL in the format like http://www.testdomain.com/application name/controllerId/actionId instead of getting http://www.testdomain.com/application name/index.php?r=controllerId/actionId in this format.

I am able to modify and hiding index.php from URL but i just want to show url in the following format:-

http://www.testdomain.com/application name

or

http://www.testdomain.com

I know that it’s something related to .htaccess file but i am not getting the right solution for this.

Please help me on this.

Thanks!!!

not sure but the only solution that i see here is using frames

How should Yii know, which controller and action was requested if they are not contained in the URL?

Hi Minase,

I know that it is possible with Frames and i have already implemented it with frames but i want to know about other solution, if it is possible.

Thanks!!!

If I understood you rightly, there is no “proper” solution. To be honest, I’m not even sure if you really want to do this.

Either do this by using frames, or do this by using ajax. Although ajax will prevent the user from being able to switch forward and backward in his browser history.

A third possibily is using POST requests only - one of our course management systems in university does so and I can tell you that it has nothing to do with usability.

Keep in mind that users will not be able to copy-paste the page’s location from the url bar in order to tell give it to friends.

** double posting **