我有。htaccess文件放在example.com/new
目录。我想重写从example.com/new/it/keyword
到example.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">