After the official announcement by Google, everyone is migrating their website from HTTP to HTTPS. From October 2017, Google Chrome has started showing a notification for being insecure on the site without SSL.
Having an old website with HTTP requires a severe note to apply HTTPS to all the blog posts and pages. Most of the people use the free SSL certificate from a CDN or Let’s Encrypt.
But the problem occurs when you have to force HTTPS all over your WordPress website. Whether you use an Apache server or NGINX, you can make a redirect without using a plugin.
Although for non-techie people, the plugin like Really Simple SSL is recommended. But when you want to avoid a plugin, you can use the .htaccess file to force HTTPS.
Sometimes, after activating an SSL certificate, some of the blog posts don’t adopt the change, and no HTTPS is visible.
In this tutorial, you’re going to learn to redirect all of your blog posts from HTTP to HTTPS without using a plugin. You’ll need to use cPanel.
Edit the .htaccess File Using cPanel When Having an Apache Server
If you don’t have any idea about servers, don’t worry. Let me give me some hints. When you buy a web hosting account from any of the companies like Siteground,InMotion Hosting,Hostinger, etc., you’ll get an Apache or possibly a Nginx web server.
When you think about starting your WordPress website, it’s best to search for the best web hosting and eventually end up buying a shared server.
And if you think about NGINX servers, those are costly and have the different technology, you don’t get cPanel. All you need are the command lines to manage your site on such servers.
For now, concentrate on dealing with the conventional web hosting you use. Follow the steps to make a redirect.
Step 1:
If you see a different layout of cPanel, it’s because every company tries to match it with their brand using a different design theme.
Step 2:
On this new page, if you see the home directory,
If you run more than one website on the same server, you need to open the respective folder.
Step 3:
Click on the top-right corner, click on the gear settings icon, and tick the box to display hidden files.
Step 4:
If you find the .htaccess file and
Click on the Edit button.
Step 5:
A new tab opens up.
<IfModule mod_rewrite.c> RewriteEngineOn RewriteCond%{HTTPS}off RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301] </IfModule>
Click on Save Changes, and you’re all set. From now onwards, all of your blogs start redirecting from HTTP to HTTPS.
If you have an NGINX server, you can add a few lines of code in the configuration file.
server { listen80; server_name yoursite.com www.yoursite.com; return301 https://yoursite.com$request_uri; }
Note: Replace yoursite.com with your website’s URL.
You have successfully set up a redirect from HTTP to HTTPS.
I Hope You Can Apply the Redirect Using cPanel
Most of the users have the shared web hosting (i.e. Apache Server), they have to use the code to add in the .htaccess file.
If users are scared of editing the coding file, they can use the redirect plugin which also adds the code in the .htaccess file.
But if you ask any WordPress experts, they always suggest you avoid plugins as much as you can. Are you going to use a plugin or not?
Conclusion
Setting the redirect from HTTP to HTTPS can be tricky in a few situations. Even after the redirect, the website may show other errors, which need advanced skills.
For now, I hope you can easily set up the redirect for all of your blog posts from HTTP to HTTPS.