Wordpress always redirects to https after copying to localhost

六眼飞鱼酱① 提交于 2020-06-27 08:33:15

问题


When I copy my wordpress installation from server to a local webserver (MAMP) and try to access localhost:8888, it always redirects http to https. So I always get an ERR_SSL_PROTOCOL_ERROR.
I can't find the setting for this anywhere – neither in the database nor somewhere else in the wordpress files. Can anybody help?


回答1:


Make sure that WP_HOME and WP_SITEURL are set to addresses that start with http, not https.

These settings should be located in wp-config.php.

define('WP_HOME','http://localhost:8888');
define('WP_SITEURL','http://localhost:8888');

Make sure you aren't telling WordPress to force SSL for admin and login.

define('FORCE_SSL_LOGIN',false);
define('FORCE_SSL_ADMIN',false);



回答2:


You need to change .htaccess file in the root of project. Change it to this code if you want to force Http :

# BEGIN Force HTTP
RewriteEngine On
RewriteCond %{SERVER_PORT} 443
RewriteRule ^(.*)$ http://yourdomain.com/$1 [R=301,L]
# END Force HTTP



回答3:


Just add this in wp-config file

define('FORCE_SSL', false); define('FORCE_SSL_ADMIN', false);



来源:https://stackoverflow.com/questions/49954680/wordpress-always-redirects-to-https-after-copying-to-localhost

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!