Step 1. Enable mod_rewrite on your Apache web server.
Step 2. Create .htaccess file in root directory.
Step 3. Redirect All Web Traffic
<IfModule mod_rewrite.c>
RewriteCond %{HTTPS} !=on [OR]
RewriteCond %{HTTP_HOST} !^www\. [NC]
RewriteRule ^(.*)$ https://www.yourdomain.com/$1 [R=301,L]
</IfModule>
Step 4. Restart Apache Server
sudo service apache2 restart
Copyright ©2022 coderraj.com. All Rights Reserved.