Config Yii By Domain Name

Please help me! :mellow: (

I am would like to configure my website Yii by name domain.

note : I want to run on my website hosting but do not run on localhost

Thanks everybody.

What is the server of your web hosting? You only need to create the domain or sub domain name and point it to the Yii app directory.

You can do this as in index.php file

$domain = $_SERVER[‘HTTP_HOST’];

// find the config file as

include ‘protected/main/’.$domain.’.php’;

I am would like to configure web of my only the running on hosting. when the different downloaded it back to the computer their, then trang web of me be can not run

I am would like to configure web of my only the running on hosting. when the different downloaded it back to the computer their, then trang web of me be can not run

Hi, correct me if I am wrong, this issue isn’t the configuration of Yii. But this is about your web hosting not working because it downloads php files. If this is web hosting, you need to enable php. If you can’t, you need to find other web hosting that supports php.

you need to do it as


if($_SERVER['HTTP_HOST']=='alloweddomain.com'){

// include the config

}else{

echo 'Invalid configuration';

}