8月中旬升级了服务器,直到约一周之前,猪漫跑过来告诉我,我的首页的导航URL出了问题。具体现象是,“下一页”的链接成了 http://cuteleo.cn/index.phpIndex.php/page/2,多了一个Index.php出来,使得链接无效。
刚开始抓破头皮也没想到是哪里的问题,只有找了个变通的办法。方法如下:
修改wp-includes/link-template.php
找到
- $qstr = preg_replace('/&([^#])(?![a-z]{1,8};)/', '&$1', trailingslashit( get_option('home') ) . $qstr );
- return $qstr;
中间加一句:
- $qstr = str_replace("index.phpIndex.php","index.php",$qstr);
使之成为:
- $qstr = preg_replace('/&([^#])(?![a-z]{1,8};)/', '&$1', trailingslashit( get_option('home') ) . $qstr );
- $qstr = str_replace("index.phpIndex.php","index.php",$qstr);
- return $qstr;
在返回变量$qstr前,把变量值里面的index.phpIndex.php替换成index.php,这样就解决问题了。
@Update:在空间控制面板里,把默认首页只留下index.php,也可以搞定。
Popularity: 34% [?]
相关日志:
0 Responses
Stay in touch with the conversation, subscribe to the RSS feed for comments on this post.