Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/laravel/11.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php 如何删除';公共';当Laravel安装在子目录中时,从Laravel URL(v5.6)开始_Php_Laravel_.htaccess - Fatal编程技术网

Php 如何删除';公共';当Laravel安装在子目录中时,从Laravel URL(v5.6)开始

Php 如何删除';公共';当Laravel安装在子目录中时,从Laravel URL(v5.6)开始,php,laravel,.htaccess,Php,Laravel,.htaccess,我使用WordPress作为我的商业网站,使用Laravel作为项目管理应用程序 这是我的目录结构 public_html -mainsite (my WordPress site is in this directory) -work (Laravel Application is in this directory) 当用户访问我的主域(例如www.example.com)时,我使用以下.htaccess规则将访问者重定向到www.example.com/mainsite

我使用WordPress作为我的商业网站,使用Laravel作为项目管理应用程序

这是我的目录结构

public_html
    -mainsite (my WordPress site is in this directory)
    -work (Laravel Application is in this directory)
当用户访问我的主域(例如www.example.com)时,我使用以下.htaccess规则将访问者重定向到www.example.com/mainsite

<IfModule mod_rewrite.c>
RewriteEngine on
RewriteCond %{HTTP_HOST} ^(www.)?example.com$
RewriteCond %{REQUEST_URI} !^/mainsite/
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /mainsite/$1
RewriteCond %{HTTP_HOST} ^(www.)?example.com$
RewriteRule ^(/)?$ mainsite/index.php [L] 
</IfModule>
现在我想允许用户使用此URL访问我的项目管理应用程序 (我想从URL中删除“public”)-

你能帮我解决这个问题吗

(当Laravel安装在根目录中时,从URL中删除“public”很容易,我知道怎么做)

这不是一个重复的问题,原因如下- 我的Laravel安装在我根目录的子目录中,我也在使用不同的站点(WordPress站点)作为我的基本URL

  • 将Laravel移到公共html之外
  • 将Laravel的公用文件夹的内容移动到公用\u html/work
  • 将以下代码放入\App\Providers\AppServiceProvider寄存器()

    $this->app->bind('path.public',function()){ 返回基本路径('public_html/work'); });


可能重复的否,这不是重复的问题。我的Laravel安装在我根目录的子目录中,我也使用不同的站点(WordPress站点)作为我的基础URLU使用Vhost?我使用的是Bigrock的Linux共享托管计划。在共享托管中,你需要将公用文件夹中的所有文件放在它之外,并编辑index.php
www.example.com/work/public
www.example.com/work