How to put your site online with yii2

Hello everyone! I am in development of a small application with YII2, when the online to test instead of directly running index.php which is in the web folder (because I use the Basic version), the server instead launches the Root of the project and all files are visible. Please how to directly launch the homepage?

Set your "web" folder as document root.

how can i do it?

please how can i do it?

http://www.yiiframework.com/doc-2.0/guide-start-installation.html#configuring-web-servers

Obviously, to the best of my knowledge, you will need a different domain or subdomain or named virtual host or ipnr or port for this second webroot.

thank y <br>but my server is apache however, i don’t know how config the file php.ini et http.cong <br>

Sorry I didn’t read your first post thoroughly. Assumed you use advanced template since you had to even ask about this. But you are using basic template so only one webroot.

You don’t mention shared hosting so you probably have all freedom to edit the apache config at /etc/apache2. (Read the Apache documentation.)

If you don’t want to change webroot there’s at least one user contributed version around, Yii 1.x-style security.

your domain is now pointed to the


../../basic

so change it to point your domain to your web root:


 ../../basic/web

and run


 ../../basic/php init

make it works.

i understand you but your last tense i don’t undertand it

sorry my friend, if i have a stupide quetions i’m new in the deploment and production with YII2.

wy do you wont me to do it? i don’t have ideas plaese

“If you don’t want to change webroot there’s at least one user contributed version around, Yii 1.x-style security.”

With this I mean the start script index.php at top level and user non-accessible files under subdir _protected.

If you would give me your hosting account access, I could fix it for you. It just about 10 min.