If you want to ensure that your website always loads with https://www (forcing both HTTPS and www), you can achieve this by adding the following rules to your .htaccess file.
📌 Steps to Implement
Locate your .htaccess file in the root directory of your website.
Open it using a text editor or cPanel’s File Manager.
Add the following code to enforce HTTPS and www redirection:
🔹 .htaccess Code
RewriteEngine On
# Force HTTPS
RewriteCond %{HTTPS} off
RewriteRule ^(.*)$ https://%{HTTP_HOST}/$1 [R=301,L]
# Force www
RewriteCond %{HTTP_HOST} ^example\.com [NC]
RewriteRule ^(.*)$ https://www.example.com/$1 [R=301,L]
🔍 Explanation
Forcing HTTPS:
If the request is not secure (HTTPS off), it redirects users to the HTTPS version.
Forcing www:
If someone tries to access your site without www (e.g., https://example.com), it redirects them to https://www.example.com.
⚠️ Important Notes
Replace example.com with your actual domain name.
This method ensures all visitors land on https://www.example.com consistently.
The [R=301,L] flag ensures a 301 permanent redirect, which is SEO-friendly.
🚀 Final Thoughts
By applying this .htaccess rule, you improve security (forcing HTTPS) and maintain a consistent domain structure (using www). This is especially useful for SEO and user experience.
Let me know in the comments if you have any questions! 😊
Wayona Nylon Braided USB to Lightning Fast Charging and Data Sync Cable Compatible for iPhone 14,13, 12,11,X, 8, 7, 6, 5, iPad Air, Pro, Mini (3 FT Pack of 1, Grey)
₹379.00 (as of February 10, 2025 16:59 GMT +05:30 – More infoProduct prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on [relevant Amazon Site(s), as applicable] at the time of purchase will apply to the purchase of this product.)
Ambrane Unbreakable 60W Fast Charging 1.5M Braided Type C to Type C Cable for Smartphones, Tablets, Laptops & Other Type C Devices, PD Technology, 480Mbps Data Sync (RCTT15, Black)
₹179.00 (as of February 10, 2025 16:59 GMT +05:30 – More infoProduct prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on [relevant Amazon Site(s), as applicable] at the time of purchase will apply to the purchase of this product.)
STRIFF Adjustable Laptop Tabletop Stand Patented Riser Ventilated Portable Foldable Compatible with MacBook Notebook Tablet Tray Desk Table Book with Free Phone Stand (Black)
₹249.00 (as of February 10, 2025 16:59 GMT +05:30 – More infoProduct prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on [relevant Amazon Site(s), as applicable] at the time of purchase will apply to the purchase of this product.)
boAt Type C A325/A320 Tangle-free, Sturdy Type C Cable with 3A Rapid Charging & 480 Mbps Data Transmission Speed, Compatible with Smartphones & Tablets(Black)
₹99.00 (as of February 10, 2025 16:59 GMT +05:30 – More infoProduct prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on [relevant Amazon Site(s), as applicable] at the time of purchase will apply to the purchase of this product.)
Dell KM3322W Wireless USB Keyboard and Mouse Combo, Anti-Fade & Spill-Resistant Keys, up to 36 Month Battery Life, 3Y Advance Exchange Warranty – Black
₹1,399.00 (as of February 10, 2025 16:59 GMT +05:30 – More infoProduct prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on [relevant Amazon Site(s), as applicable] at the time of purchase will apply to the purchase of this product.)
Panda Baby Products Baby Walker for 6 to 24 Months | 7 Level Height Adjustment Walker with Switchable Food & Musical Toy Tray/Advanced Baby Activity Walker (Pink, RGB Platinum)
₹1,699.00 (as of February 20, 2025 19:10 GMT +05:30 - More infoProduct prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on [relevant Amazon Site(s), as applicable] at the time of purchase will apply to the purchase of this product.)MyNewborn by 10club Reversible Print Soft Sherpa Fleece Baby Blanket | for Girls, Boys, Newborn, Nursery | All Season, AC Blanket | 0-12 Months | 74 X 100 X 1.5 cm | 410 GSM (Blue, Tractor)
Now retrieving the price.
(as of February 20, 2025 19:10 GMT +05:30 - More infoProduct prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on [relevant Amazon Site(s), as applicable] at the time of purchase will apply to the purchase of this product.)