在此服务器上找不到请求的 URL /login - Laravel 5

我在 Ubuntu 19.10 中使用 Laravel。问题是当我尝试访问 project_name/login 时,它说在服务器上找不到请求 url。我试图更改 apache2.conf 并更改我 laravel 项目的公共文件夹中的 .htaccess 。但它不起作用..

这是 /etc/apache2/ 中的 apache2.conf

这是我项目公共文件夹中的 .htaccess


<IfModule mod_rewrite.c>

    <IfModule mod_negotiation.c>

        Options -MultiViews -Indexes

    </IfModule>


    RewriteEngine On


    # Handle Authorization Header

    RewriteCond %{HTTP:Authorization} .

    RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]


    # Redirect Trailing Slashes If Not A Folder...

    RewriteCond %{REQUEST_FILENAME} !-d

    RewriteCond %{REQUEST_URI} (.+)/$

    RewriteRule ^ %1 [L,R=301]


    # Handle Front Controller...

    RewriteCond %{REQUEST_FILENAME} !-d

    RewriteCond %{REQUEST_FILENAME} !-f

    RewriteRule ^ index.php [L]

</IfModule>

我已经用这样的命令启用了 a2enmod 重写


 sudo a2enmod rewrite


慕姐8265434
浏览 291回答 2
2回答

慕婉清6462132

VirtualHost(在 /etc/apache2/sites-enabled/ 中)的 DocumentRoot 必须指向 /public<VirtualHost *:80>&nbsp; &nbsp; ...&nbsp; &nbsp; DocumentRoot /{Where your project is}/public&nbsp; &nbsp; ...</VirtualHost>然后重启 Apache

至尊宝的传说

您是否已将以下内容添加到 /etc/hosts10.100.1.11 &nbsp; &nbsp; &nbsp; &nbsp;localhost
打开App,查看更多内容
随时随地看视频慕课网APP