URL formatting

Hello.

I have my yii application installed in the site subdirectory of my home on the server. Thus, to get to the index page the address is


www.domain.com/site/index.php

.

Now if I use Gii to create a controller, e.g. greeting, its url would be


www.domain.com/site/index.php/greeting

.

Is there anyway I could have my greeting controller set up such that it’s accessible via


www.domain.com/site/greeting

instead?

Also, is there anyway to have


www.domain.com/

point to:


www.domain.com/site/index.php

? I mean, I’d like to remove /site from the url. I already know how to set up Apache to map


www.domain.com

to


www.domain.com/site/index.php

. What I actually want is to remove "site" from the URL.

Thanks!

Hi,

add on your main.php

‘urlManager’=>array(

‘showScriptName’=>false,

)

Hi, any other formats for Yii URL link?

I also wanted to hide index.php from the URL format, and I found a good reference page.

http://www.yiiframework.com/doc/guide/1.1/en/topics.url#hiding-x-23x

Set showScriptName to false in main config page and modify .htaccess as below.

It works nicely!


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