Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

The solution to the problem that css cannot be loaded when ssl is enabled in wordpress

2025-04-12 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/02 Report--

Editor to share with you the solution that css cannot be loaded after wordpress opens ssl. I hope you will gain a lot after reading this article. Let's discuss it together.

Wordpress open ssl after css can not load the solution: 1, find the functions.php file, and change the "js/css" path to the relative path; 2, add the code "if ($_ SERVER ['HTTP_X...)" in the wp-config.php.

The problem that css cannot be loaded when ssl is enabled in wordpress

Method 1: find functions.php and add the following code:

Add_filter ('script_loader_src',' agnostic_script_loader_src', 20style_loader_src', 2); function agnostic_script_loader_src ($src, $handle) {return preg_replace ('/ ^ (http | https): /',', $src);} add_filter ('style_loader_src',' agnostic_style_loader_src', 20 src); function agnostic_style_loader_src ($src, $handle) {return preg_replace ('/ ^ (http | https): /','', $src);}

Method 2: add this line to the wp-config.php

If ($_ SERVER ['HTTP_X_FORWARDED_PROTO'] = =' https') $_ SERVER ['HTTPS'] =' on'

But make sure your changes come before this line.

Require_once (ABSPATH. (wp-settings.php'): after reading this article, I believe you have some understanding of the solution that css cannot load after wordpress turns on ssl. If you want to know more about it, welcome to follow the industry information channel. Thank you for reading!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report