• <bdo id='IjDvx'></bdo><ul id='IjDvx'></ul>
    <i id='IjDvx'><tr id='IjDvx'><dt id='IjDvx'><q id='IjDvx'><span id='IjDvx'><b id='IjDvx'><form id='IjDvx'><ins id='IjDvx'></ins><ul id='IjDvx'></ul><sub id='IjDvx'></sub></form><legend id='IjDvx'></legend><bdo id='IjDvx'><pre id='IjDvx'><center id='IjDvx'></center></pre></bdo></b><th id='IjDvx'></th></span></q></dt></tr></i><div id='IjDvx'><tfoot id='IjDvx'></tfoot><dl id='IjDvx'><fieldset id='IjDvx'></fieldset></dl></div>

    1. <small id='IjDvx'></small><noframes id='IjDvx'>

      <tfoot id='IjDvx'></tfoot>
      <legend id='IjDvx'><style id='IjDvx'><dir id='IjDvx'><q id='IjDvx'></q></dir></style></legend>

        Yii 2.0 从 URL 中隐藏/basic/web 以及 index.php

        Yii 2.0 hiding /basic/web from the URL along with the index.php(Yii 2.0 从 URL 中隐藏/basic/web 以及 index.php)
        <tfoot id='lkgwc'></tfoot>

        • <small id='lkgwc'></small><noframes id='lkgwc'>

          <legend id='lkgwc'><style id='lkgwc'><dir id='lkgwc'><q id='lkgwc'></q></dir></style></legend>
            <i id='lkgwc'><tr id='lkgwc'><dt id='lkgwc'><q id='lkgwc'><span id='lkgwc'><b id='lkgwc'><form id='lkgwc'><ins id='lkgwc'></ins><ul id='lkgwc'></ul><sub id='lkgwc'></sub></form><legend id='lkgwc'></legend><bdo id='lkgwc'><pre id='lkgwc'><center id='lkgwc'></center></pre></bdo></b><th id='lkgwc'></th></span></q></dt></tr></i><div id='lkgwc'><tfoot id='lkgwc'></tfoot><dl id='lkgwc'><fieldset id='lkgwc'></fieldset></dl></div>

                • <bdo id='lkgwc'></bdo><ul id='lkgwc'></ul>
                    <tbody id='lkgwc'></tbody>
                • 本文介绍了Yii 2.0 从 URL 中隐藏/basic/web 以及 index.php的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  网上有很多关于如何从 Yii 2.0 应用程序 URL 中隐藏 index.php 的信息,但是,我在这里尝试做的是从 URL 中删除/basic/web/"./basic/web 是运行应用程序的目录,到目前为止我的配置如下.进入配置文件:

                  Plenty of information around the net on how to hide the index.php from your Yii 2.0 application URL, however, what I'm trying to do here is to also remove the '/basic/web/' from the URL. /basic/web is the directory from which the application is running and the configuration that I have so far is the following. That goes into the config file:

                  'urlManager' =>[
                              'enablePrettyUrl' => true,
                              'showScriptName' => false,
                          ],
                  

                  这是我在/web 文件夹中的 htaccess 文件:

                  And this is my htaccess file that I have within the /web folder:

                  RewriteEngine on
                  RewriteCond %{REQUEST_FILENAME} !-f
                  RewriteCond %{REQUEST_FILENAME} !-d
                  RewriteRule . index.php
                  

                  到目前为止,很好,我可以直接调用 mysite.com/basic/web/controller/action 访问一些东西.我需要做什么才能删除/basic/web 以使 URL 变得简单 mysite.com/controller/action?

                  So far, so good, I can access something directly calling mysite.com/basic/web/controller/action. What do I need to do though to remove the /basic/web so that the URL becomes just simple mysite.com/controller/action?

                  欢迎提供任何提示,谢谢!

                  Any tips welcome, thanks!

                  我正在寻找一种不接触 apache 配置文件的方法,因为我无权访问它.

                  I'm looking for a way without touching the apache configuration file as I don't have access to it.

                  推荐答案

                  您应该以另一种方式定义您的 apache 配置.您的网站应该指向 {folder}/basic/web 而不是 {folder}.

                  You should define your apache configuration in another way. Your site should point to {folder}/basic/web and not to {folder}.

                  因为你改变了要求:

                  对于 cpanel 设置,您应该:
                  1)删除愚蠢的基本文件夹,它有什么意义?仅仅因为 Yii 以这种方式安装并不意味着您必须保留它.因此,将所有内容向上移动 1 级.
                  2) 将 web 重命名为 public_html 确保在某些文件中也将其重命名(想到 config/bootstrap).

                  For a cpanel setup you should:
                  1) remove the silly basic folder, what is the point of it anyway? Just because Yii installs that way does not mean you have to keep it. So move everything 1 level up.
                  2) Rename web to public_html make sure you rename it in some files too (config/bootstrap comes to mind).

                  是的,您可以使用 .htaccess 来实现,但您不应将文件暴露在 Internet 上,只应暴露您的 Web 文件夹,因此我不会为您提供该解决方案,因为它不是一个好的解决方案.

                  Yes you can do it with .htaccess but you should not have the files exposed to the internet, just your web folder should be exposed so I am not giving you that solution because it is not a good one.

                  这篇关于Yii 2.0 从 URL 中隐藏/basic/web 以及 index.php的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

                  相关文档推荐

                  Is PHP or PHP based web framework stateful or stateless?(PHP 或基于 PHP 的 Web 框架是有状态的还是无状态的?)
                  How to parse django style template tags(如何解析 django 样式模板标签)
                  What is a good setup for editing PHP in Emacs?(在 Emacs 中编辑 PHP 的好设置是什么?)
                  How to check whether specified PID is currently running without invoking ps from PHP?(如何在不从 PHP 调用 ps 的情况下检查指定的 PID 当前是否正在运行?)
                  What#39;s the difference between escapeshellarg and escapeshellcmd?(escapeshellarg 和escapeshellcmd 有什么区别?)
                  php in background exec() function(php 后台 exec() 函数)
                  <tfoot id='lL0ny'></tfoot>

                • <i id='lL0ny'><tr id='lL0ny'><dt id='lL0ny'><q id='lL0ny'><span id='lL0ny'><b id='lL0ny'><form id='lL0ny'><ins id='lL0ny'></ins><ul id='lL0ny'></ul><sub id='lL0ny'></sub></form><legend id='lL0ny'></legend><bdo id='lL0ny'><pre id='lL0ny'><center id='lL0ny'></center></pre></bdo></b><th id='lL0ny'></th></span></q></dt></tr></i><div id='lL0ny'><tfoot id='lL0ny'></tfoot><dl id='lL0ny'><fieldset id='lL0ny'></fieldset></dl></div>
                • <legend id='lL0ny'><style id='lL0ny'><dir id='lL0ny'><q id='lL0ny'></q></dir></style></legend>

                        <small id='lL0ny'></small><noframes id='lL0ny'>

                        • <bdo id='lL0ny'></bdo><ul id='lL0ny'></ul>
                            <tbody id='lL0ny'></tbody>