我希望设置一个没有https的wordpress站点的测试版本,这样我就可以修复自从移动到一个新的托管服务后出现的各种问题。
测试站点正在重定向到https --它返回指向活动域的301!
我使用的是nginx,因此忽略了.htaccess文件(其他问题的来源)。
该站点确实正确地服务于非php内容,其中包含phpinfo()的.php文件也得到了正确的处理。因此,这似乎是wordpress或插件的问题。
因此,我重命名插件目录,以禁用所有插件和重新启动,重定向仍然发生!我已经清除了nginx的缓存和浏览器的缓存。
我如何进一步诊断这个问题?下面我已经复制了测试站点的nginx配置。
用于testdomain.com的语句。
服务器{ server_name testdomain.com;侦听80;
fastcgi_read_timeout 300;
root /home/ian/websites/testdomain/htsecure;
index index.php;
fastcgi_index index.php;
#
access_log /var/log/nginx/testdomain.access.log;
error_log /var/log/nginx/error.log;
#
location = /favicon.ico {
log_not_found off;
access_log off;
}
# disallow hot linking to images
location ~ .(gif|png|jpg|jpeg)$ {
valid_referers none blocked testdomain.com;
if ($invalid_referer) {
return 403;
}
}
# server static files that exist
location / {
try_files $uri $uri/ /index.php?$args;
}
# send .php files to fastcgi
location ~ \.php$ {
# Zero-day exploit defense - http://forum.nginx.org/read.php?2,88845,page=3
try_files $uri =404; # only if they exist!
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_param SCRIPT_FILENAME $document_root@fastcgi_script_name;
include /etc/nginx/fastcgi.conf;
fastcgi_pass 127.0.0.1:9000;
}}
发布于 2019-11-29 20:53:51
您应该更新数据库中的urls设置。例如,您可以使用这个链接- https://wpbeaches.com/updating-wordpress-mysql-database-after-moving-to-a-new-url/。我希望它能帮助你。
发布于 2019-11-29 18:29:08
通过将以下行添加到wp-config.php文件(在根目录中找到),使用非https域配置Wordpress:
define( 'WP_HOME', 'http://example.com' );
define( 'WP_SITEURL', 'http://example.com' );背景
重定向可能是由以下几点引起的:
理想情况下,Wordpress并不是通过一些晦涩的代码来执行重定向,所以禁用所有插件应该停止重定向。然而,您可能忽略的一个重定向是Wordpress本身立即执行的重定向,以迫使站点仅从一个指定的“站点URL”加载。
https://stackoverflow.com/questions/59109501
复制相似问题