我的远程服务器是LiteSpeed
,而不是Appache
不确定htaccess
代码是否相同
原始url-example.com/index.php?c=kb
.htaccess
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^home/(.*)$ /index.php?c=$1 [L]
加<base href="/">
结果-example.com/home/kb
-工作良好
现在我想删除home
-以获得-example.com/kb
RewriteRule . /index.php [L]
页面在那里,但缺少css
和js
似乎<base href="/">
有问题
有什么帮助吗?
查看-
example.com/kb
。服务器上-example.com/index.php?c=kb
您可以尝试以上方案的此代码:
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^([w-]+)/?$ index.php?c=$1 [L,QSA]
参考文献:
- Apache mod_rewrite简介
- Apache mod_rewrite技术详细信息
- .htaccess提示和技巧