问题
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