(Redirect HTTPS to HTTP on Apache) – Do you want to secure the WordPress site and start using the HTTPS protocol? Now it’s time to switch to HTTPS if your website has not used it yet. In this tutorial we will discuss how to redirect HTTP to HTTPS on WordPress. There are two ways you can do it.
HTTPS or Hyper Text Transfer Protocol Secure is a security version of the HTTP protocol. Information sent over HTTPS will be encrypted so it is quite difficult to steal when in the sending process. This makes the HTTP protocol suitable for an e-commerce website or website that requires users to send data.
HTTPS also has benefits for websites in general:
1. Sites using HTTPS have a higher chance of ranking than sites without HTTPS. A few years ago, Google announced if HTTPS is one of the ranking factors of a website.
2. Trust. Visitors will see a green padlock on the domain name in the browser.
By following this tutorial, you will learn two different ways to add HTTPS to WordPress.
Now many websites that are used to use HTTP (port 80) are upgraded to HTTPS (port 443) with SSL certificate. But what if you have special needs that force replace HTTPS to HTTP?
Inspired by the reader’s question, Well on this one discussion. then all I share the solution here. If we have access to the Apache configuration (which is a .conf file) then it can be added directly to it.
<VirtualHost *:443>
ServerName namedomain.com
RewriteEngine On
RewriteCond %{HTTPS} on
RewriteRule (.*) http://%{HTTP_HOST}%{REQUEST_URI}
...
</VirtualHost>
Remember, adjust to your site’s virtual host settings above code. Alternatively, it can also be used in the .htaccess file if you have trouble editing the previous way.
RewriteEngine On
RewriteCond %{HTTPS} on
RewriteRule ^$ http://%{HTTP_HOST} [L,R=301]
or:
RewriteEngine On
RewriteCond %{ENV:HTTPS} on
RewriteRule (.*) http://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
or:
RewriteEngine On
RewriteCond %{HTTP:X-Forwarded-Proto} =https
RewriteRule ^(.*)$ http://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
Please choose the preferred method which you think is easiest, and if for htaccess solution of course used only one. hopefully can help you.