当前位置: 首页 > 资料仓库 > 正文

在wp-includs文件夹下面,找到rewrite.php文件,复制保存或者下载下来。保存一下,防止修改出处,假设出错,可以覆盖还原。然后用记事本打开rewrite.php文件,找到这个函数名:function get_category_permastruct()。

function get_category_permastruct() {
  if ( isset($this->category_structure) )
   return $this->category_structure;

  if ( empty($this->permalink_structure) ) {
   $this->category_structure = ”;
   return false;
  }

  if ( empty($this->category_base) )
   $this->category_structure = trailingslashit( $this->front . ‘category’ );
  else
   $this->category_structure = trailingslashit( ‘/’ . $this->root . $this->category_base );

  $this->category_structure .= ‘%category%’;

  return $this->category_structure;
 }

然后在这个下面找到  if ( empty($this->permalink_structure) ),把这个改为  if ( !empty($this->permalink_structure) )。注意,这里只加了一个英文‘!’解决了WordPress分类目录404错误的问题。

再找到这个函数function get_tag_permastruct(),然后他里面也有一个 if ( empty($this->permalink_structure) ),一样,还是改为  if ( !empty($this->permalink_structure) )。这里只加了一个英文‘!’解决了WordPress tag标签404错误的问题。

转自 http://www.178td.cn/blog/27.html

[分享]解决WordPress启用伪静态后分类链接和Tag链接404错误:等您坐沙发呢!

发表评论