htaccess - 当 URL 不以 / 结尾时不加载 CSS



我有。htaccess文件放在example.com/new目录。我想重写从example.com/new/it/keywordexample.com/new/index.php?lang=it&keyword=keyword的每个URL。我当前的.htaccess是:

RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.+)/(.+) index.php?lang=$1&keyword=$2 [L]

问题是example.com/new/it/keyword/工作得很好,但example.com/new/it/keyword不加载CSS和图像,它只加载HTML。我该怎么修理它?

在HTML页面中使用样式表和其他资产的绝对路径,如

<link rel="stylesheet" href="/path/to/css/styles.css">

最新更新