wordpress迁移问题总结
- 设置固定连接访问
nginx配置
location / {
index index.html index.php;
if (-f $request_filename/index.html) {
rewrite (.*) $1/index.html break;
}
if (-f $request_filename/index.php) {
rewrite (.*) $1/index.php;
}
if (!-f $request_filename) {
rewrite (.*) /index.php;
}
}
1
2
3
4
5
6
7
8
9
10
11
12
2
3
4
5
6
7
8
9
10
11
12
- 访问域名修改
修改数据库表wp_options
option_name的值
siteurl
home
1
2
3
2
3
- 设置https访问
wp-config.php添加如下内容
$_SERVER[‘HTTPS’] = ‘on’;
define(‘FORCE_SSL_LOGIN’, true);
define(‘FORCE_SSL_ADMIN’, true);
继续修改wp-includes/load.php或wp-includes/functions.php 这个文件,搜索is_ssl找到对应的函数,将$SERVER['HTTPS']修改为$_SERVER['HTTP_FROM_HTTPS']
(修改文件前请注意备份)。
或将此函数修改为:
function is_ssl() {
if (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == 'on'){
return true;
}
elseif (isset($_SERVER["HTTP_FROM_HTTPS"])&&$_SERVER["HTTP_FROM_HTTPS"]=='on'){
return true;
}
elseif (isset($_SERVER['HTTP_X_FORWARDED_PROTO']) && $_SERVER['HTTP_X_FORWARDED_PROTO'] == 'https'){
return true;
}
else{
return false;
}
}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
2
3
4
5
6
7
8
9
10
11
12
13
14
上次更新: 2023/06/09, 19:14:23