A
A
Artem Prokhorov2021-07-08 14:47:46
Yii
Artem Prokhorov, 2021-07-08 14:47:46

How to make subdomains in Yii2+Apache?

There is, for example domain.loc, and it has an entry point in the form of index.php, but I need to get into this index.php both by domain.loc, and by >back.domain.loc. Yes, and in principle I want to specify several domain names and control the path to the entry point.

Tried

<VirtualHost *:80>
    DocumentRoot "%ssitedir%/yii/frontend/web"
    ServerName api.domainq.loc
    <Directory "%ssitedir%/yii/frontend/web">
        Order Allow,Deny
        Allow from all
    </Directory>
</VirtualHost>

But it just doesn't work. And I want to note that I use OpenServer, there are 2 config files:
D:\OpenServer\modules\http\Apache_2.4-PHP_7.2-7.4\conf\httpd.conf

which is lower in the hierarchy than this one:
D:\OpenServer\userdata\config\Apache_2.4-PHP_7.2-7.4_server.conf
, that is, it Apache_2.4-PHP_7.2-7.4_server.confchanges the settings httpd.conf, and if you write the code above in httpd.conf, then it will simply be erased when you restart the op, which is why you need to enter the code in Apache_2.4-PHP_7.2-7.4_server.conf.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
B
Bogdan Khvalko, 2021-07-08
@quitting

Add your domain or subdomain via OSpanel settings60e6ffac4e18733524509.png

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question