首页 > 解决方案 > Laravel Routes not working 404 not found

问题描述

我更换了我的电脑并在 Windows 10 WSL 上安装了灯。主索引有效/但路线无效。这是我的虚拟主机文件。

<VirtualHost 127.0.0.2:80>
    DocumentRoot /var/www/devroot/lara/panel/public
    DirectoryIndex index.php
    <Directory "/var/www/devroot/lara/panel/public">
        Options All
        AllowOverride All
        Order Allow,Deny
        Allow from all
    </Directory>
</VirtualHost>

这是来自项目的 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>

当我访问路由链接时出现错误。

Not Found

The requested URL /lara/panel/public/admin was not found on this server.
Apache/2.4.18 (Ubuntu) Server at localhost Port 80

标签: phplaravel

解决方案


问题是htaccess被隐藏了我的坏我将它从_htaccess修改为.htaccess,现在它正在工作。


推荐阅读