PHP .htaccess重定向

时间:2018-02-28 04:38:09

标签: php .htaccess

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

  1. 如果请求为localhost/project/home
  2. ,一切正常
  3. 但是如果将请求更改为localhost/project/home/,则所有链接都无效。
  4. 这是文件夹架构 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]
    

    由于

1 个答案:

答案 0 :(得分:1)

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

<link rel="stylesheet" type="text/css" href="http://localhost/project/css/style.css">