• Post last modified:December 25, 2022
  • Reading time:4 mins read

Redirect Your WordPress Website From HTTP to HTTPS Without Installing any Plugin

In this post, you will learn how you can redirect your WordPress website from HTTP to HTTPS without installing any plugin, just by editing the .htaccess file on your web server.

You can also do this using a plugin but as you know installing much more plugin will make your website slower that negatively impacts the SEO. By reading this post you will be able to do this by yourself and you can save your space for other more essential plugins.

Why do You Need this?

Maybe you already have activated the SSL certificate for your site. But still, you need to redirect from HTTP to HTTPS because when any user enters only the domain name (example.com) of your site in the search bar without HTTPS then the user will not be redirected to HTTPS version of your site. The browser will show your site as unsecured to the user and also it can affect your SEO ranking.

Forcing HTTP to HTTPS on All Traffic

One of the many functions you can perform via .htaccess is the 301 redirects. This is very important that your site must Automatically be redirected from HTTP (http://example.com) to HTTPS (https://example.com or https://www.example.com) to get AdSense Approval.

If your site will not automatically redirect from HTTP to HTTPS then AdSense may not approve your site, they will send a “site down or unavailable” message.

You can activate the feature to force HTTPS on all incoming traffic by following these steps:

  1. Go to your hosting cPanel and find the SSL certificate section, there you will see a “Force HTTPS” option click on it.
  2. Now go to your domain’s File Manager, inside the public_html folder look for a .htaccess file and open it.
  3. Then copy and paste the code given below (for Apache server) just after this line “RewriteEngine On”
RewriteCond %{HTTPS} off
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
  1. Save the file, and now all your incoming traffic will automatically redirected to HTTPS.

Now Make Some Changes in WordPress Dashboard

Now you also have to make some changes in your WordPress dashboard to work this redirection correctly.

  1. Login to WordPress dashboard > Click on Settings > General
  2. In the general settings area, you will see two options (I) WordPress Address (URL) (II) Site Address (URL)
  3. Now Change both URLs to https://www.yourDomain.com
  4. Again if you don’t want to use www then you should remove it from both WordPress and Site Address URLs
  5. Click on Save Changes.
WordPress Address URL and Site URL
WordPress Address URL

So this was all on How you can force HTTPS on your site or how to redirect all incoming traffic from HTTP to HTTPS in the WordPress website without installing any plugins.

If you still have any question related to this post, feel free to ask in the comment section below, I will reply to you as soon as possible.