Answer the question
In order to leave comments, you need to log in
How to create on hosting 3 subdomains to the main site?
If I wrote in the wrong topic, please correct me.
Guys, such a problem, I need to create 3 sub-domains for the main site.
Example:
Main site site.com Subdomains
:
seeds.site.com
admin.site.com
szr.site.com.
The site is hosted on the hosting ukraine.com.ua. Sites are written in Yii2 Framework, there I use one index.php entry point Index.php
example
defined('YII_DEBUG') or define('YII_DEBUG', true);
defined('YII_ENV') or define('YII_ENV', 'dev');
require(__DIR__ . '/../vendor/autoload.php');
require(__DIR__ . '/../vendor/yiisoft/yii2/Yii.php');
require(__DIR__ . '/../common/config/bootstrap.php');
switch ($_SERVER['HTTP_HOST']) {
case 'frontend.dev':
case 'growex.com.ua':
define('YII_APP', 'frontend');
break;
case 'seeds.dev':
case 'seeds.growex.com.ua':
define('YII_APP', 'seeds');
break;
case 'szr.dev':
case 'szr.growex.com.ua':
define('YII_APP', 'szr');
break;
case 'backend.dev':
case 'admin.growex.com.ua':
define('YII_APP', 'backend');
break;
default:
header("HTTP/1.1 301 Moved Permanently");
header("Location: growex.com.ua");
}
define('YII_APP_DIR', Yii::getAlias('@apps') . '/' . YII_APP);
apps
-----backend - admin.site.com
-----frontend - site.com
-----seeds - seeds.site.com
-----szr - szr.site.com
common
console
vendor
web
-----assets
-----css
-----js
-----fonts
-----images
-----uploads
-----htaccess
-----index.php - то самый файл, через него проходит точка входа и он проверяет на домен
htaccess
requirements.php
init.php
composer
.... и всякий другой мусор
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question