my home page and root of my website

Hi,

I want to install my website in following directory :

C:\inetpub\wwwroot\myWebSiteYii2

So The root of my website (1st lavel) is into "myWebSiteYii2"

The URL of my home page is : http://127.0.0.10/index.php

So my home page file is C:\inetpub\wwwroot\[color="#8B0000"]myWebSiteYii2[/color]\index.php

But when I installed Yii2.0, my home page is : C:\inetpub\wwwroot\myWebSiteYii2\[color="#8B0000"]web[/color]\index.php

and The URL of my home page is : http://127.0.0.10/[color="#8B0000"]web[/color]/index.php

How I can change this place (127.0.0.10/[color="#8B0000"]web[/color]/index.php) by 127.0.0.10/index.php removing the name ‘[color="#8B0000"]web[/color]’ in URL ? :rolleyes:

How can I ?

Do you know if the configuration of my installation is wrong ? :mellow:

I tried it like as :

on CMD commande


C:\inetpub\wwwroot\myWebSiteYii2>composer create-project --prefer-dist yiisoft/yii2-app-basic

Thanks

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

thanks Tri,

But this doc is for the configuration on Apache or Nginx server.

My web server works on [b]IIS /b.

So how I can change http://127.0.0.10/yii2-app-basic/web/ by http://127.0.0.10/ ?

Thanks

New UI, not tried. You may set "physical route path" for the site in IIS Manager.

You may want to look at this https://technet.microsoft.com/en-us/library/cc754640(v=ws.10).aspx

  • URL gets mangled, look up "Change the Physical Path of Virtual Directory Content".

We are sorry. The page you requested cannot be found.

HI

in \yii2-app-basic\config here is a php file : web.php

I see this code :


        'db' => require(__DIR__ . '/db.php'),

        /*

        'urlManager' => [

            'enablePrettyUrl' => true,

            'showScriptName' => false,

            'rules' => [

            ],

        ],

        */

So I can use : enablePrettyUrl’ => true

So Do you know if I add /change this file for get http://127.0.0.10/ instead of change http://127.0.0.10/yii2-app-basic/web/ by ?

search technet.microsoft.com for the page about IIS Manager

Something like "Change the Physical Path of Virtual Directory Content"

Or search for a tweaked yii2 basic, something like "yyi2_basic_ext"

Good luck!

Hi,

I have two solution with web.config file (generated by IIS )

[font="Arial Black"]1st one :[/font]

[xml]<httpRedirect enabled="true" destination=" http://127.0.0.10/yii2-app-basic/web/index.php" exactDestination="false" childOnly="true" httpResponseStatus="Found" />[/xml]

[list=1]

[*]When you tape this url :

http://127.0.0.10/ — >

you arrive this url : http://127.0.1.10/yii2-app-basic/web/index.php/

[*]but when you write

http://127.0.0.10/index.php or http://127.0.0.10/toto — >

You see : http://127.0.1.10/yii2-app-basic/web/index.php/index.php or

http://127.0.1.10/yii2-app-basic/web/index.php/toto

So it is [color="#8B0000"]404[/color] Page not found.

[*]if you tape

http://127.0.1.10/toto/toto.php — >

you can see the contents toto.php file in toto directory.

[/list]


or you can also try next one

2nd one :

[xml] <rewrite>

		&lt;rules&gt;


			&lt;rule name=&quot;Rewrite Only Root to Virtual Directory&quot; stopProcessing=&quot;true&quot;&gt;


			  &lt;match url=&quot;^/?&#036;&quot; /&gt;


			  &lt;conditions&gt;


					&lt;add input=&quot;{REQUEST_FILENAME}&quot; matchType=&quot;IsFile&quot; negate=&quot;true&quot; /&gt;


			  &lt;/conditions&gt;


			  &lt;action type=&quot;Rewrite&quot; url=&quot;/yii2-app-basic/web/index.php&quot; /&gt;


			&lt;/rule&gt;





		&lt;/rules&gt;





	&lt;/rewrite&gt;[/xml]

[list=1]

[*]When you tape this url :

http://127.0.0.10/ — >

you see the same contents ‘Congratulations! page’ (yii2-app-basic/web/index.php/site/index) without change http://127.0.0.10/

[*]but when you write

http://127.0.0.10/index.php or http://127.0.0.10/toto — >

You see the contents index.php or toto.php file in root directory. So You can not see ‘Congratulations! page’ (yii2-app-basic/web/index.php/site/index)

[*]if you tape

http://127.0.1.10/toto/toto.php — >

you can see the contents toto.php file in toto directory.

[/list]

Bye :)

The purpose of moving the Document Root to a subdir (web) is that files which shouldn’t be accessible from the web, will not be.

Alternative: the user contributed "Yii2 basic ext" rearranged the template so web root will be at top level (original document root)

I think, it is a best solution.

thanks Tri