Home  >  Article  >  CMS Tutorial  >  How to set up ssl certificate in wordpress

How to set up ssl certificate in wordpress

尚
Original
2019-07-13 14:00:286323browse

How to set up ssl certificate in wordpress

WordPress is currently a popular website system. Because it is simple and easy to use, even if you do not know programming technology, you can build a website by yourself, which saves both cost and time. As search engine technology improves, websites with security certificates installed are given priority, so more and more websites are beginning to deploy SSL certificates. If you want to deploy an SSL certificate, the rented server must be an independent IP, otherwise it cannot be installed. So, how to deploy an SSL certificate on a WordPress website? This article mainly introduces this issue in detail.

Specific steps for deploying SSL certificates on WordPress websites:

1. Upload the SSL installation certificate to the server;

2. Enter the "Website Directory" and find usr/local In the "website domain name.conf" file in the /Nginx/conf directory, add the following fields to the file:

listen 443 ssl;
ssl_certificate/usr/local/nginx/cert/213979626930477.pem;
ssl_certificate_key /usr/local/nginx/cert/213979626930477.key;

3. Restart nginx. At this time, the SSL configuration has taken effect.

4. Log in to the WordPress website backend, modify the wordpress address and site address, and replace them with https://, as follows:

How to set up ssl certificate in wordpress

5. Change wordpress Replace the website http link with https

HTTPS absolute link replacement: Replace the http link in the wordpress website with https, and put the code below in the theme function.php file. (This replacement is only for internal links, external links are invalid)

How to set up ssl certificate in wordpress

HTTPS relative link replacement: Replace the http link in the wordpress website with a // relative link, that is, referenced in http http resources, https references https resources, and automatically adapts. The code is as follows:

How to set up ssl certificate in wordpress

#6. Set up jumps for http and https

In order to prevent the loss of the weight of the original website, or give the search engine the illusion of duplicate pages , we need to 301 redirect the original http link of the website to https.

Open the "website domain name.conf" file in step 2 and add the following code to the location in the picture:

if ($server_port = 80) {
return 301 https://$server_name$request_uri;
}
if ($scheme = http) {
return 301 https://$server_name$request_uri;
}
error_page 497 https://$server_name$request_uri;

How to set up ssl certificate in wordpress

7. Then add "Nginx" can be restarted. Then you can check whether the setting is successful by visiting the page.

Friendly reminder: After the SSL security certificate is deployed, submit it to the Baidu search resource platform to help search engines adapt to the https path as soon as possible.

For more wordpress related technical articles, please visit the wordpress tutorial column to learn!

The above is the detailed content of How to set up ssl certificate in wordpress. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn