Skip to content


Wordpress 首页导航中的 index.phpIndex.php 问题

8月中旬升级了服务器,直到约一周之前,猪漫跑过来告诉我,我的首页的导航URL出了问题。具体现象是,“下一页”的链接成了 http://cuteleo.cn/index.phpIndex.php/page/2,多了一个Index.php出来,使得链接无效。

刚开始抓破头皮也没想到是哪里的问题,只有找了个变通的办法。方法如下:

修改wp-includes/link-template.php
找到

  1. $qstr = preg_replace('/&([^#])(?![a-z]{1,8};)/', '&$1', trailingslashit( get_option('home') ) . $qstr );
  2.     return $qstr;

中间加一句:

  1. $qstr = str_replace("index.phpIndex.php","index.php",$qstr);

使之成为:

  1. $qstr = preg_replace('/&([^#])(?![a-z]{1,8};)/', '&$1', trailingslashit( get_option('home') ) . $qstr );
  2. $qstr = str_replace("index.phpIndex.php","index.php",$qstr);
  3. return $qstr;

在返回变量$qstr前,把变量值里面的index.phpIndex.php替换成index.php,这样就解决问题了。

@Update:在空间控制面板里,把默认首页只留下index.php,也可以搞定。

Popularity: 34% [?]

相关日志:

Posted in 电脑网络. Tagged with , .

0 Responses

Stay in touch with the conversation, subscribe to the RSS feed for comments on this post.

Some HTML is OK

(never shared)

or, reply to this post via trackback.


SEO Powered by Platinum SEO from Techblissonline