{"id":9604,"date":"2026-06-03T07:19:07","date_gmt":"2026-06-03T05:19:07","guid":{"rendered":"https:\/\/mybox.com\/help\/?post_type=manual_kb&#038;p=9604"},"modified":"2026-06-03T07:19:08","modified_gmt":"2026-06-03T05:19:08","slug":"cum-sa-fortezi-un-site-web-sa-utilizeze-https-printr-o-redirectionare-in-fisierul-htaccess","status":"publish","type":"manual_kb","link":"https:\/\/mybox.com\/help\/ro\/knowledgebase\/how-to-force-a-website-to-use-https-with-an-htaccess-redirect\/","title":{"rendered":"Cum s\u0103 for\u021ba\u021bi un site web s\u0103 utilizeze HTTPS cu o redirec\u021bionare .htaccess"},"content":{"rendered":"<div class=\"translation-block translation-block-merged\">\n<p class=\"wp-block-paragraph\">If your website has an active SSL certificate, you can automatically redirect visitors from HTTP to HTTPS using rules placed in the <code>.htaccess<\/code> file.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">This ensures that all visitors access the secure version of your website, regardless of whether they enter:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>http:&#47;&#47;yourdomain.com<\/code><\/pre>\n\n\n\n<\/div>\n\n<div id=\"mybox-3797984735\" class=\"mybox-content mybox-entity-placement\"><div class=\"early-access-banner-inpost\">\r\n  <div class=\"banner-left-inpost\">\r\n    <div class=\"icon-box-inpost\">\r\n      <img decoding=\"async\" src=\"https:\/\/mybox.com\/help\/wp-content\/uploads\/2026\/02\/square-info-icon.svg\" alt=\"Info\">\r\n    <\/div>\r\n    <div class=\"text-box-inpost\">\r\n      <span class=\"label-inpost\"><span class=\"translation-block translation-block-banner-text\">Acces timpuriu<\/span><\/span>\r\n      <h4><span class=\"translation-block translation-block-banner-text\">Mai ave\u021bi nevoie de ajutor?<\/span><\/h4>\r\n      <p><span class=\"translation-block translation-block-banner-text\">Contacta\u021bi echipa noastr\u0103 de servicii pentru clien\u021bi.<\/span><\/p>\r\n    <\/div>\r\n  <\/div>\r\n\r\n  <div class=\"banner-right-inpost\">\r\n    <a href=\"https:\/\/panel.mybox.com\/helpdesk2\/v\/list\/\" class=\"banner-button-inpost\"><span class=\"translation-block translation-block-banner-text\">Trimite mesaj<\/span><\/a>\r\n  <\/div>\r\n<\/div><\/div>\n\n<div class=\"translation-block translation-block-merged\"><p class=\"wp-block-paragraph\">or<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>https:&#47;&#47;yourdomain.com<\/code><\/pre>\n\n\n\n<div id=\"ez-toc-container\" class=\"ez-toc-v2_0_86 ez-toc-wrap-left counter-hierarchy ez-toc-counter ez-toc-custom ez-toc-container-direction\">\n<div class=\"ez-toc-title-container\">\n<p class=\"ez-toc-title\" style=\"cursor:inherit\">Table of Contents<\/p>\n<span class=\"ez-toc-title-toggle\"><\/span><\/div>\n<nav><ul class='ez-toc-list ez-toc-list-level-1' ><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-1\" href=\"https:\/\/mybox.com\/help\/ro\/knowledgebase\/how-to-force-a-website-to-use-https-with-an-htaccess-redirect\/#Before_You_Begin\" >Before You Begin<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-2\" href=\"https:\/\/mybox.com\/help\/ro\/knowledgebase\/how-to-force-a-website-to-use-https-with-an-htaccess-redirect\/#Redirect_All_Traffic_to_HTTPS\" >Redirect All Traffic to HTTPS<\/a><ul class='ez-toc-list-level-3' ><li class='ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-3\" href=\"https:\/\/mybox.com\/help\/ro\/knowledgebase\/how-to-force-a-website-to-use-https-with-an-htaccess-redirect\/#How_It_Works\" >How It Works<\/a><\/li><\/ul><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-4\" href=\"https:\/\/mybox.com\/help\/ro\/knowledgebase\/how-to-force-a-website-to-use-https-with-an-htaccess-redirect\/#Redirect_All_Traffic_to_HTTPS_and_WWW\" >Redirect All Traffic to HTTPS and WWW<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-5\" href=\"https:\/\/mybox.com\/help\/ro\/knowledgebase\/how-to-force-a-website-to-use-https-with-an-htaccess-redirect\/#Alternative_Redirect_to_HTTPS_Without_WWW\" >Alternative: Redirect to HTTPS Without WWW<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-6\" href=\"https:\/\/mybox.com\/help\/ro\/knowledgebase\/how-to-force-a-website-to-use-https-with-an-htaccess-redirect\/#Verify_the_Redirect\" >Verify the Redirect<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-7\" href=\"https:\/\/mybox.com\/help\/ro\/knowledgebase\/how-to-force-a-website-to-use-https-with-an-htaccess-redirect\/#Common_Issues\" >Common Issues<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-8\" href=\"https:\/\/mybox.com\/help\/ro\/knowledgebase\/how-to-force-a-website-to-use-https-with-an-htaccess-redirect\/#Summary\" >Summary<\/a><\/li><\/ul><\/nav><\/div>\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"Before_You_Begin\"><\/span>Before You Begin<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Make sure that:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>An SSL certificate is active for your domain.<\/li>\n\n\n\n<li>HTTPS works correctly when accessed directly.<\/li>\n\n\n\n<li>The website uses Apache-compatible <code>.htaccess<\/code> rules.<\/li>\n<\/ul>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"Redirect_All_Traffic_to_HTTPS\"><\/span>Redirect All Traffic to HTTPS<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Open the <code>.htaccess<\/code> file located in your website&#8217;s main directory, typically:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>public_html\/.htaccess<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Add the following rules near the beginning of the file:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>RewriteEngine On<br>RewriteCond %{HTTPS} !=on<br>RewriteRule ^ https:\/\/%{HTTP_HOST}%{REQUEST_URI} &#91;L,R=301]<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"How_It_Works\"><\/span>How It Works<span class=\"ez-toc-section-end\"><\/span><\/h3>\n\n\n\n<ul class=\"wp-block-list\">\n<li><code>RewriteEngine On<\/code> enables URL rewriting.<\/li>\n\n\n\n<li><code>RewriteCond %{HTTPS} !=on<\/code> checks whether the connection is not using HTTPS.<\/li>\n\n\n\n<li><code>RewriteRule<\/code> redirects the visitor to the HTTPS version of the same URL.<\/li>\n\n\n\n<li><code>R=301<\/code> creates a permanent redirect, which is recommended for SEO purposes.<\/li>\n<\/ul>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"Redirect_All_Traffic_to_HTTPS_and_WWW\"><\/span>Redirect All Traffic to HTTPS and WWW<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">If you want all visitors to use both HTTPS and the <code>www<\/code> prefix, use the following rules instead:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>RewriteEngine On<br>RewriteCond %{HTTPS} !=on<br>RewriteRule ^ https:\/\/www.%{HTTP_HOST}%{REQUEST_URI} &#91;L,R=301]<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Example:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>http:&#47;&#47;yourdomain.com<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">becomes:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>https:&#47;&#47;www.yourdomain.com<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"Alternative_Redirect_to_HTTPS_Without_WWW\"><\/span>Alternative: Redirect to HTTPS Without WWW<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">If you prefer the non-WWW version of your website, you can use:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>RewriteEngine On<br>RewriteCond %{HTTPS} !=on<br>RewriteRule ^ https:\/\/yourdomain.com%{REQUEST_URI} &#91;L,R=301]<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Replace:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>yourdomain.com<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">with your actual domain name.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"Verify_the_Redirect\"><\/span>Verify the Redirect<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">After saving the <code>.htaccess<\/code> file:<\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li>Open your website using <code>http:\/\/<\/code>.<\/li>\n\n\n\n<li>Confirm that the browser automatically redirects to <code>https:\/\/<\/code>.<\/li>\n\n\n\n<li>Verify that the SSL certificate is displayed correctly and that no security warnings appear.<\/li>\n<\/ol>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"Common_Issues\"><\/span>Common Issues<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">If the redirect does not work:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Verify that the SSL certificate is active.<\/li>\n\n\n\n<li>Ensure the <code>.htaccess<\/code> file is located in the correct directory.<\/li>\n\n\n\n<li>Check for conflicting redirect rules.<\/li>\n\n\n\n<li>Clear your browser cache before testing again.<\/li>\n<\/ul>\n\n\n\n<p class=\"wp-block-paragraph\">If you encounter a redirect loop, review any existing HTTPS redirects configured within your CMS, plugin, or application settings.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"Summary\"><\/span>Summary<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">To force all visitors to use HTTPS, add the following rule to your website&#8217;s <code>.htaccess<\/code> file:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>RewriteEngine On<br>RewriteCond %{HTTPS} !=on<br>RewriteRule ^ https:\/\/%{HTTP_HOST}%{REQUEST_URI} &#91;L,R=301]<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">This permanently redirects all HTTP requests to the secure HTTPS version of your website, helping improve security, user trust, and SEO performance.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><\/p>\n<\/div>","protected":false},"author":1,"featured_media":0,"parent":0,"menu_order":0,"template":"","format":"standard","manualknowledgebasecat":[125],"manual_kb_tag":[718,719,721,722,723,772,372,518,531,588],"class_list":["post-9604","manual_kb","type-manual_kb","status-publish","format-standard","hentry","manualknowledgebasecat-websites","manual_kb_tag-htaccess-file","manual_kb_tag-url-rewriting","manual_kb_tag-rewriteengine","manual_kb_tag-rewriterule","manual_kb_tag-rewritecond","manual_kb_tag-domain","manual_kb_tag-ssl-certificate","manual_kb_tag-public_html","manual_kb_tag-domain-name","manual_kb_tag-website"],"_links":{"self":[{"href":"https:\/\/mybox.com\/help\/ro\/wp-json\/wp\/v2\/manual_kb\/9604","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/mybox.com\/help\/ro\/wp-json\/wp\/v2\/manual_kb"}],"about":[{"href":"https:\/\/mybox.com\/help\/ro\/wp-json\/wp\/v2\/types\/manual_kb"}],"author":[{"embeddable":true,"href":"https:\/\/mybox.com\/help\/ro\/wp-json\/wp\/v2\/users\/1"}],"version-history":[{"count":1,"href":"https:\/\/mybox.com\/help\/ro\/wp-json\/wp\/v2\/manual_kb\/9604\/revisions"}],"predecessor-version":[{"id":9606,"href":"https:\/\/mybox.com\/help\/ro\/wp-json\/wp\/v2\/manual_kb\/9604\/revisions\/9606"}],"wp:attachment":[{"href":"https:\/\/mybox.com\/help\/ro\/wp-json\/wp\/v2\/media?parent=9604"}],"wp:term":[{"taxonomy":"manualknowledgebasecat","embeddable":true,"href":"https:\/\/mybox.com\/help\/ro\/wp-json\/wp\/v2\/manualknowledgebasecat?post=9604"},{"taxonomy":"manual_kb_tag","embeddable":true,"href":"https:\/\/mybox.com\/help\/ro\/wp-json\/wp\/v2\/manual_kb_tag?post=9604"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}