
大家都知道wordpress后台自带三种形式的链接形式:
?p=123
2013/01/11/sample-post/
archives/123
沈阳网站设计除第一种形式外,
后两种都需要web服务器支持Rewrite。
而部分虚拟主机都不支持Rewrite,因此wordpress做到伪静态化就需要用其他办法。
操作如下:
1.在wordpress后台Permalinks设置中,沈阳网站建设选取最后一个,“Custom, specify below”,在自定义结构中填入:/index.php/%post_id%.html
要显示的URL形式为:index.php/123.html
2.前台现实日志、分页、按日期浏览均可正常工作,唯独分类不能正常显示。分类超级链接URL中不是get_the_category_by_ID,而是分类名字。
在wp-includes目录下,有名为template-functions-category.php的文件(有的版本文件名不完全相同),打开编辑此文件。
找到函数function get_category_link,此函数开始部分有一语句“$catlink = $wp_rewrite->get_category_permastruct();”,注释掉即可。
这样分类部分即可正常显示。
3.修改根目录下index.php文件,沈阳网站建设确保路径中有p参数的都301重定向到新的URL。