Topnotch Innovative Technologies

Conversion of A WordPress Website from HTTP to HTTPS - A Helpful Guide

Share:

Admin

Admin

TopNotch Inv.

Websites are either running on HTTP or HTTPs. Now, Google has confirmed that your ranking will not suffer when you shift from HTTP to HTTPS. July 2018 was the last date set for the HTTPs implementation. The company further instructed that for an HTTP domain, Chrome address bars will have a label of “not secure”.

How to convert a website from HTTP to HTTPS?

Here we will be discussing the procedure to convert the HTTP to HTTPS. We hope that you have enough WordPress coding skills and SSL certificate installed on your server. Most of the hosting providers offer this feature with just one click. Before moving on to the steps, let’s get an overview of the structure and what does migration mean?

Overview of WordPress Website Structure

Every WordPress website has cores files and a database where the content of a website is stored. If you are planning to migrate, then you need to take a backup of your website. You can do this with the help of your hosting provider. This is needed so that you can restore your website in case of any problem. Furthermore, you need to download the respective files to do a search and replace operation on your computer.

Some of the popular hosting providers are HostGator, GoDaddy, and BlueHost.

What Does A Migration from HTTP TO HTTPS Mean?

In the process of migration, we are replacing any instance of HTTP resource that is pointing to your website or domain with an HTTPS equivalence.

Keep one thing in mind, when HTTP website loads resource of HTTPS it may cause a problem of mixed content. To avoid this problem, you need to ensure that the resources of a website do not point to an HTTP endpoint:

The resources are images, iframes, videos, CSS Files, JavaScript Files, internal URLs used in CSS/JavaScript files, audio, fonts, and form actions. Only check your plugins or theme files. Never make changes in the cores files located in wp-admin and wp-includes folders. They are already HTTPS compatible. If you do any changes, then unexpected bugs might appear.

How can I change http to https in WordPress?

The steps of migration are listed below:

1-Search and Replace in Files

In the start, you must search for the instances of your domain that are pointing to HTTP URLs of your website. Utilize the regex for “www” and without “www “URL cases and look for http:\/\/(www\.)?yourdomain\.com

Place the actual domain name in yourdomain.com section. After the search you may see some instances of source files to your domain HTTP endpoint. As said earlier, if you have already installed the SSL certificate on your hosting, then you can safely replace all domain links with HTTPS equivalent. You need to do the same for your Plugins folder only in case, you have custom developed plugins that are not hosted at wordpress.org/plugins.

It is recommended that use WordPress own built functions to get a home URL. This practice will ensure that the correct source link will be displayed always.

Take care of the HTTP resource pointing to external domains. To perform this, you need to search for string http:// present in your Active Theme folders and Plugins.

In the right section of the browser tree, you will see all instances of HTTP resources. Don’t replace all the HTTPS at once! The reason behind this is that external HTTP domain that the resource is pointing to may not have an SSL certificate installed. In addition, you may not get support and WordPress HTTPS connection.

In case, if you are planning to replace in bulk with checking that your external domain support HTTPS connection, then you may end up getting broken resources or images on the website. With this you will experience errors while loading the external source.

If you are experiencing a problem, then you need to identify the functionality that is using the resource and then reprogram it. The solution of this problem is you simply download the files to your server and link it by yourself. This option is better for images. This practice may not be possible every time so redevelop it to get rid of the functionality.

In addition to this, other than script or images src attributes and images you need to look for HTTP:// instance of following two things:

  • Form actions, For e.g. <form action=”http://example.com/”> you can search for action=”HTTP://
  • Fonts/CSS files, example <link rel=”stylesheet” type=”text/css” href=”http://example.com/>. For researching you can use this regex <link * href=”http://

After you have gone through all your files, now come to the next step.

2-Search and Replace in Database

For this, you first need to download a search and replace database tool. Upload this in your folder with a long unique name like replace 534534364533434984. This is needed for security so that no one can find it easily. When you will move to yourdomain.com/ replace 534534364533434984 following things will appear.

In this case, again you need to replace all your domain HTTP instances with HTTPS as an SSL certificate is installed and your domain supports HTTPS.

If your images are still pointing to an external HTTP domain, use Import External Images plugin to find them and fix the issue.

After the installation of the plugin click on the Import button. The downloading of images from an external website will start and replace the external images URLs with your domain HTTPS ones. This process is not easy, as it may result in a black screen when loading or it may take down your server as well. To tackle this problem, you can increase your server max_excetion_time and memory limit. Secondly, this problem occurs with large websites. In some cases, you will need to have advanced coding skills to resolve the issue.

Generally, it is recommended to upload external images to your server with media uploader and don’t use external URLs. External images get broken when the hosting domains expire or files get deleted. After you are done with fixing the issues of images, iframes, videos, and audio is left.

The first and easy step you can do is to perform the same search and replace the operation for well-known audio/video hosting such as Vimeo, Soundcloud, Vimeo, etc. As they support HTTPS, you can safely replace:

For YouTube: http: \/\/(www\.)? youtube\.com with https://www.youtube.com,

For Vimeo: http: \/\/(www\.)? vimeo\.com with https://www.vimeo.com etc.

The resources other than well-known domains, there is no way to import them automatically because they are large files. You need to do a search by performing SQL query to identify them and manually fix them.

To extract all your post, you can use the following code that contains

src=http://global $wpdb; $results = $wpdb->get_results( “SELECT ID FROM “.$wpdb->posts.” WHERE (  post_content LIKE ‘%src=\”http://%’ OR post_content LIKE \”%src=’http://%\” OR post_content LIKE ‘%src=http://%’ )  AND post_status = ‘publish’ and post_type = IN(‘post’,’page’) order by post_date desc”, OBJECT ); foreach ($results as $post) {echo get_permalink($post->ID).'<br/>’;}

Keep one thing in mind, you can add post type to list IN(‘post’,’page’), separated with commas if running this over a custom post type.

After running this query, you will get a list of all posts that have HTTP sources and Mixed content issue. After it finishes, do check again to avoid missing any instances with HTTP resources. It is a good practice to browse website manually for a while and check it through Google Chrome Console to ensure that it is clean.

After everything is on its place, now, finally set up the 301 WordPress HTTP redirect loop from HTTP URLs to HTTPS.

3-Implementation of Redirects

Talking specifically, if your server runs on Apache, you can put the following code to your .htaccess file. You need to be very careful when performing this step. If you make any mistake in the command it can greatly affect the website.

Put the following code on top:

<IfModule mod_rewrite.c>

RewriteEngine On

RewriteCond %{HTTPS} off

RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]

</IfModule>

You can also use Easy HTTPS Redirection plugin for this purpose.

4-Upgrade CDN

If you see a CDN, there will be a URL setting similar to Google Analytics. Here you can update your website to an HTTPS version. The method of migration for each CDN is different. For support and details, you need to check your CDN provider documents.

5-Change Your URL in Google Analytics

To change the Website URL setting in Google Analytics you need to follow the below path:

Admin > Property > Property Settings and Admin > View > View Settings.

6-Re-submitting Website in Search Console

Google treats HTTP and HTTPS website differently. You need to re-submit your website HTTPS version to Google Search Console to get ownership of the property. Furthermore, you also need to re-submit your sitemap and your disavow file.

Conclusion

Hopefully, this article will assist you in the migration process. The process is not as straightforward as it seems. For a small website, you need hours whereas for an old or big website you need days to finish the work. After completing all steps, ensure that your migration is done properly and everything is running smoothly without any bugs. Furthermore, looking for web design services and web development services in Boston, cape cod and all over USA, you can contact TopNotch Innovative Technologies expert web designers and web developers today.

Discover

Latest Posts