I wish to set up a test version of a wordpress site, without
https, so I can fix various issues that have arisen since it was
moved to a new hosting service.
The test site is redirecting to https – it returns a 301 pointing to the live domain!
I am using nginx, so .htaccess files are ignored (a source of other issues).
The site DOES serve non-php content properly and a .php file with phpinfo()
in it, was served correctly. So it would appear to be wordpress or a plugin issue.
So I renamed the plugin directory to disable ALL plugins and rebooted, and the redirection still happens! I have cleared nginx’s cache and the browser’s cache.
How can I diagnose the issue further? Below I have copied my nginx config for the test site.
Statements for testdomain.com on thebe.
server {
server_name testdomain.com;
listen 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;
}
}
2
Answers
Configure WordPress with your non-https domain by adding the following lines to the
wp-config.php
file (found in your root directory):Background
The redirection could be caused by a few things:
Ideally, your WordPress is not performing redirects willy-nilly via some obscure code — so, disabling all plugins should stop the redirection. However, one redirection you may have missed is the redirection that WordPress itself performs immediately to force the site to load from just the one specified “site URL”.
You should update urls settings in database. For example you can use this link – https://wpbeaches.com/updating-wordpress-mysql-database-after-moving-to-a-new-url/. I Hope it help you.