How can I change my project www.mysite.com/testdrive to www.mysite.com on host ?

How can I change my project www.mysite.com/testdrive to www.mysite.com on host ?

Ive finished my project and now I’ve load my project on host server.

Maybe I gotta include testdrive/index.php in mysite.com/index.php?

Who can solve this problem correctly?

Unless you want to move the whole directory to the parent, you may want to add htaccess redirection (if you’re on apache).

Hi, what if after I migrate my old php apps to Yii, but my client already bookmark my old link, e.g.:

http://abcdef.com/admin/login.php

But my new Yii link:

http://abcdef.com/index.php?r=admin/login

How can I make changes at my side, to allow the old url still working, without send a redirect to client side and ask their browser redirect to new link (in a single request and response)? Because bandwidth and time is a concern. Can I make it at my server side?

Yes, you can, assuming you are allowed to put htaccess files on your server. You can have all non-existent files (like admin/login.php) rerouted to your Yii entry script without redirecting browsers.

Please look at the bundled htaccess file in your downloaded Yii package.

Can’t you just change the docroot in your virtual host? Note that, DocumentRoot cannot go in .htaccess

Or do something like this in .htaccess:




RewriteEngine on

RewriteRule ^/$ /testdrive/



Thanks guys,

I used .htaccess in root.

And wrote in

RewriteEngine on

RewriteCond $1 !^(index\.php|demos|framework|testdrive|requirements|site|yii|robots\.txt)

RewriteRule ^(.*)$ /testdrive/$1 [L]

It’s working fine.

Now I’m trying to make r=controller/action to just controller/action


    'components' => array(

        'urlManager' => array(

            'urlFormat'         => 'path',