Warning: Use of undefined constant smart_ads_days - assumed 'smart_ads_days' (this will throw an Error in a future version of PHP) in /www/wwwroot/welovelead.net/wp-content/plugins/smart-ads/smartads.php on line 341
WordPress后台有固定链接选项,有很多种页面链接样式。我们可以通过伪原创规则和一些functions代码的改动来实现页面链接形式为“文章ID.html”。
首先,你的网站根目录必须上传相应的伪原创规则(空间上必须支持伪原创),win主机和linux主机的规则不一样,这点大家可以自己去查去找,这里不赘述。
上传完规则后,打开wp后台——外观——编辑——functions.php,把下列代码复制到最后的?>之前并保存。
// 页面链接添加html后缀
add_action(‘init’, ‘html_page_permalink’, -1);
function html_page_permalink() {
global $wp_rewrite;
if ( !strpos($wp_rewrite->get_page_permastruct(), ‘.html’)){
$wp_rewrite->page_structure = $wp_rewrite->page_structure . ‘.html’;
}
}
然后,回到设置——固定链接那里,勾选自定义结构,后面的空白添加“/%post_id%.html”并保存。
这样就实现了页面链接形式为文章ID.html的形式。

最新评论
有志者事竟成
我们咽下了这口气
完成祖国统一
楼主写的很好
感谢博主的精彩分享
求邀请码
有邀请码吗
想要邀请码
太太,求个邀请码~ :raz
求一个邀请码,谢啦