WordPress 3.1升级失败解决
刚刚把WordPress.v3.0.5升级到WordPress.v3.1
升级到wordpress 3.1后,网站首页打不开怎么办?
完成升级步骤以后,却无法正常打开首页了,但是后台可以正常的访问!有点让人着急~~~~
原来是wordpress加了一段代码让所有页面都做一次模板判断跳转,为什么wordpress要加以上代码让所有页面都做一次模板判断跳转?点击以下链接:Turn Off WordPress Homepage URL Redirection给出了答案,是wordpress针对一个页面存在多个网址的SEO优化。
比如
- http://spaghetti4u.com
- http://spaghetti4u.com/index.php
- http://www.spaghetti4u.com
- http://www.spaghetti4u.com/index.php
上面这几个网址都是指向我的博客首页,但对于搜索引擎来说是存在相同页面内容的多个URL,不利于网站的SEO。于是wordpress引入了“Canonical URL Redirection”技术,将多个网址重定向到其中一个网址上,也便是上面所说的wordpress新加代码的功能。
好了!说了这么多,该告诉大家怎么解决这个问题了:
打开:wp-include/template-loader.php这个文件,在这个文件开头有这么一段代码:
<?php
/**
* Loads the correct template based on the visitor’s url
* @package WordPress
*/if ( defined(‘WP_USE_THEMES’) && WP_USE_THEMES )
do_action(‘template_redirect’);
我们只要将后面的一段代码去掉就可以了。
if ( defined(‘WP_USE_THEMES’) && WP_USE_THEMES )
do_action(‘template_redirect’);
转载请注明
1条评论▼