首页 > 解决方案 > 除了 Laravel 中的主页 url,所有链接都不起作用

问题描述

我已经在 Xampp 中成功运行了一个 Laravel 项目。但只有家庭 url 可以正常工作。但是对于所有其他链接(例如:菜单、项目详细信息等)css 和 js 不起作用。

我的主页是

http://localhost:90/office/sencare/

和示例 css 或 js 链接是

http://localhost:90/office/sencare/frontend/css/style.css

但是对于所有其他链接,此 css 或 js 链接将自动更改,例如:

http://localhost:90/frontend/css/style.css

office/sencare后失踪localhost:90

.env 文件

APP_NAME=Laravel
APP_ENV=local
APP_KEY=base64:Dm34MLg8AbQk4ADyIG9cYPaIwYbQgrUgrN7Ani/x+JA=
APP_DEBUG=true
APP_URL=http://localhost:90/office/sencare/

.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>

样本.blade.php 在此处输入图像描述

找不到解决方案在哪里更改。

有人帮忙吗?提前致谢。

请告诉我是否还有其他需要

标签: laravel

解决方案


根文件夹/公共/前端/css/style.css

这应该是 style.css 的路径,根据您的代码验证它


推荐阅读