K
K
Konstantin2016-04-22 19:21:19
WordPress
Konstantin, 2016-04-22 19:21:19

It causes 404 error and styling issue when going from http to https, what is the reason?

Good afternoon, dear ones!

Did:

1. In the wp-config.php file

define('FORCE_SSL_ADMIN', true);
if ($_SERVER['HTTP_X_FORWARDED_PROTO'] == 'https')
$_SERVER['HTTPS']='on';
define('WP_HOME','https://osagi.ru');
define('WP_SITEURL','https://osagi.ru');


2. Used the Better Search Replace plugin to replace absolute links with relative ones.
3. Cleaned up .htaccess. Added:
RewriteCond %{HTTP:X-HTTPS} !1
RewriteRule ^(.*)$ https://%{HTTP_HOST}/$1 [R=301,L]

<IfModule mod_headers.c>
# this domain should only be contacted in HTTPS for the next 12 months
Header set Strict-Transport-Security "max-age=31536000" env=HTTPS
</IfModule>


As a result, a 404 error on the pages (padlock green)
/wp-admin issues ERR_TOO_MANY_REDIRECTS

Please indicate in which direction to swim. Thank you!

Answer the question

In order to leave comments, you need to log in

1 answer(s)
G
Gleb Kemarsky, 2016-04-22
@DuDeLnIK

Suspicion of cyclic forwarding. Try to dig here .
UPD 1. Now in the code of your HTTPS pages all links are defined as HTTP. And links to publications, and links to styles. When I manually make style addresses in the form href="//osagi.ru/... , the pages look right. I think after that the problems with the redirect will disappear. In general, Google recommends not specifying the protocol in links to resources. .
UPD 2 Check that in the WordPress admin panel in the "General Settings" http was replaced with https . Unfortunately, wordpress does not accept a site address without a protocol, and it is not possible to feed it an address that starts with //.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question