- You can automatically redirect your website visitor from http://www.yourwebsite.com to https://www.yourwebsite.com in various ways.
- This blog post will show you how to redirect your website from http to https using a simple .htaccess file saved on your web server.
- Step 1: Install & configure mod_ssl on your Apache HTTP Server.
- Step 2: Enable the mod_rewrite modules by editing the ‘httpd.conf’ apache configuration file.
- Step 3: create an ‘.htaccess’ file and write the following code on that .htaccess file & save the file on your web server document root directory.
RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI}
- Step 4: That’s all. Now your website will always redirect from http://www.yourwebsite.com to https://www.yourwebsite.com
Pro Apache (Expert's Voice)