首页 > 解决方案 > 无法在 Laravel 应用程序中运行 Laravel 5 应用程序 - 未找到 Http 异常

问题描述

我是 Laravel 的新手,并试图弄清楚这种情况。我有一个 Laravel 5 应用程序。现在我必须在其Sub Directory中进行一些更改来运行相同的应用程序。所以我所做的是,我将应用程序复制到v2 子目录中,如下所示:

在此处输入图像描述

.htaccessMain Application和的根v2 Application

<IfModule mod_rewrite.c>

    <IfModule mod_negotiation.c>
        Options -MultiViews
    </IfModule>

    RewriteEngine On
    RewriteBase /


    # Send requests to public directory...
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule ^ public/index.php [L]
 # Redirect Trailing Slashes...
    RewriteRule ^(.*)/$ /$1 [L,R=301]

</IfModule>
<IfModule security2_module>
    SecRuleRemoveByTag unoeuro
</IfModule>

v2 Application公共文件夹中的.htaccess :

<IfModule mod_rewrite.c>
    <IfModule mod_negotiation.c>
        Options -MultiViews
    </IfModule>

    RewriteEngine On

    # Redirect Trailing Slashes If Not A Folder...
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule ^(.*)/$ /$1 [L,R=301]
    RewriteBase /v2/

    # Handle Front Controller...
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteRule ^ index.php [L]

    # Handle Authorization Header
    RewriteCond %{HTTP:Authorization} .
    RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
</IfModule>

这是我v2 Application通过http://localhost:8000/v2访问时的结果:

在此处输入图像描述

我尝试了很多方法,但都失败了。任何帮助将不胜感激!谢谢。

标签: php.htaccesslaravel-5routingroutes

解决方案


推荐阅读