PHP .htaccess重定向

问题描述 投票:1回答:1

嗨,我的重定向规则有问题。目前我将所有页面重定向到index.php,路由将检查正确的控制器。

  1. 如果请求是localhost/project/home,一切正常
  2. 但如果将请求更改为localhost/project/home/所有链接都无法正常工作。

这是文件夹架构enter image description here

这就像它在localhost/project/home enter image description here上的样子

这就是它在localhost/project/home/ enter image description here上的样子

这是我的.htacess

RewriteEngine On

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-l

RewriteRule ^(.*+)$ index.php?path=$1 [QSA,L]

谢谢

php .htaccess
1个回答
1
投票

似乎你的css文件没有加载,因为它没有获得正确的路径。如果你可以在你的CSS链接中使用baseUrl更好,如下所示。

<link rel="stylesheet" type="text/css" href="http://localhost/project/css/style.css">
© www.soinside.com 2019 - 2024. All rights reserved.