Php 将Yi2部署到共享主机中,直接部署到基本模板文件夹

Php 将Yi2部署到共享主机中,直接部署到基本模板文件夹,php,deployment,yii2,Php,Deployment,Yii2,我已经从Yii2官方网站上阅读了将Yii2部署到共享主机的文档,以及关于此的讨论: 因此,我决定使用sftp上传yii2文件夹。 这是我共享主机中的目录列表 access-logs etc logs public_ftp public_html ssl www (this is a link folder to public_html) 你知道,因为共享主机可以在5个域之前一直保留域, 是否可以将yii2basic文件夹上载到公用html文件夹 结果如下: access-logs etc lo

我已经从Yii2官方网站上阅读了将Yii2部署到共享主机的文档,以及关于此的讨论:

因此,我决定使用sftp上传yii2文件夹。 这是我共享主机中的目录列表

access-logs
etc
logs
public_ftp
public_html
ssl
www (this is a link folder to public_html)
你知道,因为共享主机可以在5个域之前一直保留域, 是否可以将yii2basic文件夹上载到公用html文件夹

结果如下:

access-logs
etc
logs
public_ftp
public_html
    -basic
        - bunch of yii folders here
ssl
www (this is a link folder to public_html)
mydomain.com/index.php
因为现在,如果我想访问我的网站,我必须这样写:
mydomain.com/basic/public\u html/index.php

我需要这样:

access-logs
etc
logs
public_ftp
public_html
    -basic
        - bunch of yii folders here
ssl
www (this is a link folder to public_html)
mydomain.com/index.php

请指导我。

如果您不介意在根文件夹中放置一堆Yii 2文件夹,只需将所有基本模板文件夹(web除外)和文件放在根文件夹中即可。然后将
web
文件夹的内容放入
public\u html
文件夹中

应该是这样的:

access-logs
assets
commands
config
controllers
etc
logs
mail
models
public_ftp
public_html
    // here should be the content of web folder of Yii 2 basic app
runtime
ssl
test
views
widgets

是的,你可以上传到
public\u html
文件夹中,但我现在使用yii2 basic app面临的唯一问题是漂亮的URL,你可以克隆或上传
public\u html
文件夹中的全部内容,我所做的如下所示,唯一的区别是我有一个
web
文件夹,而不是
www

目录结构

public_html
  assets
  commands
  config
  controller
  mail
  migrations
  models
  runtime
  tests
  vendor
  views
  web
public_html/.htaccess

<IfModule mod_rewrite.c>
    Options +SymLinksIfOwnerMatch
    RewriteEngine On
</IfModule>

<IfModule mod_rewrite.c>
    RewriteCond %{REQUEST_URI} ^/.*
    RewriteRule ^(.*)$ web/$1 [L]

    RewriteCond %{REQUEST_URI} !^/web/
    RewriteCond %{REQUEST_FILENAME} !-f [OR]
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule ^.*$ web/index.php
</IfModule>
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d

RewriteRule ^(.*)$ /index.php?/$1 [L]

这是可行的,但在显示
/web/index.php?r=site/index
的URL中,当我在配置文件
urlManager
中打开
prettyUrl
时,它只会显示默认的索引页,我试图打开的每个链接都会在主页视图中结束,尽管地址栏中的URL是正确的,并且urlManager解析了规则没错,这就是我所做的。

您是否能够将
public\u html
作为指向其他文件夹的符号链接?默认情况下,在提供程序上,“www”文件夹是指向公共的符号链接\u htmlt这不是我要求的…这是云服务器上最简单的yii部署指南,您可以轻松创建一个web根路径,从domain.com为您的应用程序提供服务。