前言
今天在做wordpress的cloudflare的缓存时,出现重定向次数过多
记录一下自己解决的过程,留个底 在github里的地址一定要与wordpress的后台地址一致,这很重要
然后在cloudflare 选择SSL级别为完全(严格)
wp-config.php文件加就是始终把ssl打开
$_SERVER['HTTPS'] = 'on'; define('FORCE_SSL_LOGIN', true); define('FORCE_SSL_ADMIN', true);
其实说起来简单,但是折腾了我一下午
这样下来就解决了重定向次数过多的问题
最后根本性的解决办法是找到
wp-include/template-loader.php
* Loads the correct template based on the visitor's url * * @package WordPress */ //if ( wp_using_themes() ) { /** * Fires before determining which template to load. * * @since 1.5.0 */ // do_action( 'template_redirect' ); //}
把if ( wp_using_themes() )、do_action( ‘template_redirect’ );、}这三个行注释掉,全网找答案,最后终于解决了,基本下找不到解决问题的方法,机缘巧合一下,拼凑解决了这问题!
嗨,这是一条评论。 要开始审核、编辑及删除评论,请访问仪表盘的“评论”页面。 评论者头像来自Gravatar。