Redirecting HTTP to HTTPS Using .htaccess File
Redirecting htt to https using .htaccess file, but make sure your site installs an SSL certificate, you can also see How to install an SSL Certificate
Editing .htaccess in cPanel
- Login to cPanel
- Files > File Manager > Document Root for:
- Now select the domain name you want to access
- Check “Show Hidden Files (dotfiles)” See below Image
- After a new tab or window opens, look for the .htaccess file.
- Right click on the .htaccess file and click on “Code Edit” on the menu.
- A dialogue box may pop up asking about encoding. Click the “Edit” button to continue.
- Edit the file
RewriteEngine On
### WWW & HTTPS
# ensure www.
RewriteCond %{HTTP_HOST} !^www\. [NC]
RewriteRule ^ https://www.%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
# ensure https
RewriteCond %{HTTP:X-Forwarded-Proto} !https
RewriteCond %{HTTPS} off
RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
- “Save Changes”.
- Test your website to make sure it is done correctly.
Writted by
Sharabindu Bakshi
Sharabindu is not just a tech whiz. He is an excellent communicator and collaborator. Working closely with clients to understand their goals and preferences. Whether you are a small business owner looking to establish your online presence or a seasoned entrepreneur looking to take your website to the next level, Sharabindu will work tirelessly to exceed your expectations.
You may also Like
How to disable URL from WordPress comments text
WordPress comment forms are an essential aspect of engagement for any website utilizing this versatile content management system (CMS). While
How to Add Barcode to WooCommerce Site
Barcodes are an important element on your WooCommerce site. Adding a barcode can be helpful for inventory management, product identification,
How To Add QR Code In WooCommerce Order email
QR codes are everywhere now. QR code in WooCommerce is an essential element of order emails. Adding a QR code
Boosting the efficiency of WooCommerce with barcodes
How implementing barcode technology can streamline your WooCommerce site operations and increase efficiency Table of Content Optimizing Inventory Control Enhancing