emlog 去除分类目录前的sort,请先开启伪静态
EMLOG使用伪静态后,分类URL网址中有个sort字样,这个让很多人着实不爽,都想把这个sort去掉。把sort去掉,直接显示网址/分类别名 的形式,这样有利于搜索引擎收录,也使网址更加简明。例如:
原网址:http://blog.emlog.pro/sort/code 更改后:http://blog.emlog.pro/code
修改教程
1.首先确认你的站点支持Rewrite,确认支持Rewrite后开启伪静态
2.修改include\lib\url.php文件,删除 sort/
$sortUrl = BLOG_URL . 'sort/' . $sort_index; 改成 $sortUrl = BLOG_URL . $sort_index; $sortUrl = BLOG_URL . 'sort/' . $sort_index . '/page/'; 改成 $sortUrl = BLOG_URL . $sort_index . '/page/';
3.修改include\lib\dispatcher.php文件中
return $path;
替换成
if($path!="/"&&substr($path,0,6)!="/sort/"&&substr($path,0,2)!="/?") {
return "/sort".$path;
} else {
return $path;
}
4.修改include\lib\dispatcher.php文件中
$path = str_ireplace('index.php', '', $path);
替换成
$path = str_ireplace('/index.php', '', $path);