简体   繁体   English

在配置为在其他服务器上以HTTPS身份运行后,如何强制WordPress使用HTTP,而不是HTTPS

[英]How to force WordPress to use HTTP, --not— HTTPS after being configured to run as HTTPS on other server

How do I definitively and totally stop WordPress from rewriting all URLs from HTTP to HTTPS? 如何彻底彻底阻止WordPress将所有URL从HTTP重写为HTTPS?

I need to set it up on a testing server and run there without an SSL certificate on an internal-only server so I can test PHP 7.2 which is breaking my live WP site with my plugin mix. 我需要在测试服务器上进行设置,并在没有SSL证书的情况下在仅内部服务器上运行,以便可以测试PHP 7.2,这破坏了我的实时WP网站与插件的混合。

I have got a copy of the site on a different server but I simply cannot get it to STOP using HTTPS on every single link – it currently fails to load as it keeps requesting HTTPS but there is no certificate or set up loaded on the testing server to use HTTPS and apache isn't even listening on port 443 on that testing server. 我已经在另一台服务器上获得了该站点的副本,但是我无法在每个链接上使用HTTPS使其停止运行–当前加载失败,因为它一直在请求HTTPS,但是测试服务器上没有证书或设置加载使用HTTPS和apache甚至没有监听该测试服务器上的端口443。

Already changed the WP_HOME and WP_SITEURL in wp-config.php to refer to HTTP, and used the test server's IP instead of the site domain name. 已经将wp-config.php中的WP_HOME和WP_SITEURL更改为引用HTTP,并使用了测试服务器的IP而不是站点域名。 Also put in 也放在

define(‘FORCE_SSL_ADMIN’, false);
define(‘FORCE_SSL’,false);

Dumped the DB to disc, truncated the live tables, then text-replaced all https://domainname.com occurrences with http://192.168.0.1 (for example) in the dumpfile, and reloaded every table's data back into it to get rid of ALL references to “https” in any URLs in the DB. 将数据库转储到磁盘,截断活动表,然后在转储文件中将所有https://domainname.com出现的内容替换为http://192.168.0.1 (例如),然后将每个表的数据重新加载回去以获取删除数据库中任何URL中对“ https”的所有引用。

Put this in my .htaccess (which DOES get parsed, as I can crash the testing server's httpd by putting crud into it): 将其放在我的.htaccess文件中(不会被解析,因为我可以通过将crud放入测试服务器的httpd来使其崩溃):

.
.
RewriteCond %{SERVER_PORT} ^443$
RewriteRule ^(.*)$ http://%{HTTP_HOST}/$1 [R=301,L]

RewriteCond %{HTTPS} on
RewriteRule (.*) http://%{HTTP_HOST}%{REQUEST_URI} [R=301,L]
.
.

So: 所以:

The .htaccess deliberately rewrites any requests to port 443 or HTTPS to HTTP. .htaccess故意将对端口443或HTTPS的所有请求重写为HTTP。

There is an index.htm and index.html that specify 192.168.0.1/index.php in the /var/www/html folder via meta refresh tags. 通过meta refresh标签在/ var / www / html文件夹中有一个index.htm和index.html指定192.168.0.1/index.php。

The wp-config specifies for WP_HOME and WP_SITEURL “ http://192.168.0.1 ” and FORCE_SSL_* are set to “false”. wp-config为WP_HOME和WP_SITEURL指定“ http://192.168.0.1 ”,并且FORCE_SSL_ *设置为“ false”。

But still, referencing in a browser 但是仍然在浏览器中引用

http://192.168.0.1 or http://192.168.0.1/index.php

always results in 总是导致

https://192.168.0.1

being rewritten in the browser address bar and then the browser just stops and reports the page as unreachable. 在浏览器地址栏中被重写,然后浏览器将停止并报告页面无法访问。 Have cleared cache and can insert arbitrary “die(…” commands and see them render if I CTRL F5, so the browser cache is not a factor. 已经清除了缓存,并且可以插入任意的“ die(…”命令),如果我按CTRL F5,则可以看到它们的呈现,因此浏览器缓存不是一个因素。

All I want to do is test if PHP 7.2 will break my site – on a testing server without HTTPS. 我要做的只是在没有HTTPS的测试服务器上测试PHP 7.2是否会破坏我的网站。

What is there besides .htaccess, wp-config.php and the associated MySQL database that still forces WP to HTTPS instead of HTTP when directly referencing in a web browser the testing server's 192.168.0.1 IP? 除了.htaccess,wp-config.php和关联的MySQL数据库以外,当在Web浏览器中直接引用测试服务器的192.168.0.1 IP时,仍然迫使WP改为HTTPS而非HTTP的功能是什么?

I just need WP to -actually- use 我只需要WP即可使用

http://192.168.0.1 http://192.168.0.1

and stick with that instead of each time making it https://192.168.0.1 并坚持下去,而不是每次都这样做https://192.168.0.1

Expected result is to not see URL rewriting in WordPress from http:// to https:// in the browser address bar on the testing server. 预期结果是在测试服务器的浏览器地址栏中看不到WordPress中从http://到https://的URL重写。

Stefan 斯特凡

Ok found the solution (at least partially) to this. 确定找到了解决方案(至少部分)。

Had a plugin called "Really Simple SSL" loaded. 加载了名为“ Really Simple SSL”的插件。 Manually disabled this, and now the site is at least partially loading. 手动禁用此功能,现在站点至少已部分加载。 Still have severe errors and mangled URLs that don't work, but at least it is not each time jumping into HTTPS. 仍然有严重的错误和URL混乱不起作用,但至少不是每次都跳入HTTPS。

Thanks for the replies! 感谢您的答复!

Stefan 斯特凡

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM