How to differentiate between a redirection made by Apache vs Wordpress
# curl -sLD - the-url-to-check | head -30
$ curl -sLD - http://URLtotest/
HTTP/1.1 301 Moved Permanently
Content-Type: text/html; charset=UTF-8
Content-Length: 0
Connection: keep-alive
Keep-Alive: timeout=15
Date: Mon, 23 Sep 2019 17:14:12 GMT
Server: Apache
X-Powered-By: PHP/7.2.22
X-Redirect-By: WordPress
Location: https://URLtotest/
HTTP/1.1 301 Moved Permanently
Content-Type: text/html; charset=UTF-8
Content-Length: 0
Connection: keep-alive
Keep-Alive: timeout=15
Date: Mon, 23 Sep 2019 17:14:12 GMT
Server: Apache
X-Powered-By: PHP/7.2.22
X-Redirect-By: WordPress
Location: https://URLtotest/
### Here Apache is doing a redirection from www to non-www (there is no X-Redirect-By: WordPress)
$ curl -sLD - http://www.URLtotest.com/ | head -30
HTTP/1.1 301 Moved Permanently
Content-Type: text/html; charset=UTF-8
Content-Length: 0
Connection: keep-alive
Keep-Alive: timeout=15
Date: Mon, 23 Sep 2019 17:18:49 GMT
Server: Apache
X-Powered-By: PHP/7.2.22
Location: http://URLtotest.com/
HTTP/1.1 200 OK
Content-Type: text/html; charset=UTF-8
Transfer-Encoding: chunked
Connection: keep-alive
Keep-Alive: timeout=15
Date: Mon, 23 Sep 2019 17:18:50 GMT
Server: Apache
Expires: Mon, 23 Sep 2019 18:18:50 GMT
Pragma: public
Cache-Control: max-age=3600, public
X-Powered-By: W3 Total Cache/0.9.7
Last-Modified: Thu, 01 Jan 1970 00:00:00 GMT
ETag: "7118495d6d84053e693f5ca7f39b74a7"
HTTP/1.1 301 Moved Permanently
Content-Type: text/html; charset=UTF-8
Content-Length: 0
Connection: keep-alive
Keep-Alive: timeout=15
Date: Mon, 23 Sep 2019 17:18:49 GMT
Server: Apache
X-Powered-By: PHP/7.2.22
Location: http://URLtotest.com/
HTTP/1.1 200 OK
Content-Type: text/html; charset=UTF-8
Transfer-Encoding: chunked
Connection: keep-alive
Keep-Alive: timeout=15
Date: Mon, 23 Sep 2019 17:18:50 GMT
Server: Apache
Expires: Mon, 23 Sep 2019 18:18:50 GMT
Pragma: public
Cache-Control: max-age=3600, public
X-Powered-By: W3 Total Cache/0.9.7
Last-Modified: Thu, 01 Jan 1970 00:00:00 GMT
ETag: "7118495d6d84053e693f5ca7f39b74a7"
If you cannot run that command, you can use this web http://www.redirect-checker.org
It provides more information than other webs (look at the console output).
If Wordpress itself is the component doing the redirection, you can
on: wp-includes/functions.php
add these lines:
remove_action('template_redirect', 'redirect_canonical');
remove_filter('template_redirect','redirect_canonical');
remove_filter('template_redirect','redirect_canonical');
However that doesn't mean that you will be able to login on wp-admin, for that you have to
On: wp-config.php
change the true for false
define('FORCE_SSL_ADMIN', true);
Let me know if it helped you.