{"id":49,"date":"2025-12-17T07:17:12","date_gmt":"2025-12-17T06:17:12","guid":{"rendered":"https:\/\/mybox.com\/help\/?post_type=manual_kb&#038;p=49"},"modified":"2026-06-02T05:37:29","modified_gmt":"2026-06-02T03:37:29","slug":"fisierul-htaccess-ce-este-si-pentru-ce-este","status":"publish","type":"manual_kb","link":"https:\/\/mybox.com\/help\/ro\/knowledgebase\/htaccess-file-what-is-it-and-what-is-it-for\/","title":{"rendered":".Fi\u0219ierul .htaccess - ce este \u0219i pentru ce este folosit?"},"content":{"rendered":"\n<div class=\"translation-block translation-block-merged\">\n<p class=\"wp-block-paragraph\">The <code>.htaccess<\/code> file is a configuration file used on Apache-based web servers. It allows you to control how a website behaves without modifying global server settings.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">It is commonly used in hosting environments to define rules for redirects, security, performance, and URL structure.<\/p>\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\/htaccess-file-what-is-it-and-what-is-it-for\/#What_is_an_htaccess_file\" >What is an .htaccess file?<\/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\/htaccess-file-what-is-it-and-what-is-it-for\/#Why_does_the_file_start_with_a_dot\" >Why does the file start with a dot?<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-3\" href=\"https:\/\/mybox.com\/help\/ro\/knowledgebase\/htaccess-file-what-is-it-and-what-is-it-for\/#What_is_htaccess_most_commonly_used_for\" >What is .htaccess most commonly used for?<\/a><ul class='ez-toc-list-level-3' ><li class='ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-4\" href=\"https:\/\/mybox.com\/help\/ro\/knowledgebase\/htaccess-file-what-is-it-and-what-is-it-for\/#1_Directory_protection\" >1. Directory protection<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-5\" href=\"https:\/\/mybox.com\/help\/ro\/knowledgebase\/htaccess-file-what-is-it-and-what-is-it-for\/#2_Redirects\" >2. Redirects<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-6\" href=\"https:\/\/mybox.com\/help\/ro\/knowledgebase\/htaccess-file-what-is-it-and-what-is-it-for\/#3_PHP_configuration_adjustments\" >3. PHP configuration adjustments<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-7\" href=\"https:\/\/mybox.com\/help\/ro\/knowledgebase\/htaccess-file-what-is-it-and-what-is-it-for\/#4_Caching_rules\" >4. Caching rules<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-8\" href=\"https:\/\/mybox.com\/help\/ro\/knowledgebase\/htaccess-file-what-is-it-and-what-is-it-for\/#5_Error_logging_and_debugging\" >5. Error logging and debugging<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-9\" href=\"https:\/\/mybox.com\/help\/ro\/knowledgebase\/htaccess-file-what-is-it-and-what-is-it-for\/#6_HTTPS_redirection\" >6. HTTPS redirection<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-10\" href=\"https:\/\/mybox.com\/help\/ro\/knowledgebase\/htaccess-file-what-is-it-and-what-is-it-for\/#7_Directory_listing_protection\" >7. Directory listing protection<\/a><\/li><\/ul><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-11\" href=\"https:\/\/mybox.com\/help\/ro\/knowledgebase\/htaccess-file-what-is-it-and-what-is-it-for\/#Practical_implications\" >Practical implications<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-12\" href=\"https:\/\/mybox.com\/help\/ro\/knowledgebase\/htaccess-file-what-is-it-and-what-is-it-for\/#Summary\" >Summary<\/a><\/li><\/ul><\/nav><\/div>\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"What_is_an_htaccess_file\"><\/span>What is an .htaccess file?<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<\/div>\n\n<div id=\"mybox-2579192363\" 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\">Early access<\/span><\/span>\r\n      <h4><span class=\"translation-block translation-block-banner-text\">Still need help?<\/span><\/h4>\r\n      <p><span class=\"translation-block translation-block-banner-text\">Contact our customer service team.<\/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\">Message us<\/span><\/a>\r\n  <\/div>\r\n<\/div><\/div>\n\n<div class=\"translation-block translation-block-merged\"><p class=\"wp-block-paragraph\">Originally, the <code>.htaccess<\/code> file was designed to control access to specific directories on a server.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Today, it is mainly used to:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>override default server settings<\/li>\n\n\n\n<li>define website rules for URL rewriting<\/li>\n\n\n\n<li>configure redirects and security behavior<\/li>\n\n\n\n<li>adjust PHP-related parameters (when supported)<\/li>\n<\/ul>\n\n\n\n<p class=\"wp-block-paragraph\">The rules inside the file apply to the directory where it is located and all its subdirectories unless overridden by another <code>.htaccess<\/code> file further down the structure.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"Why_does_the_file_start_with_a_dot\"><\/span>Why does the file start with a dot?<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">On Linux-based servers, files that start with a dot are hidden by default.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">This means:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><code>.htaccess<\/code> may not be visible in FTP clients<\/li>\n\n\n\n<li>you may need to enable \u201cshow hidden files\u201d in tools like FileZilla<\/li>\n\n\n\n<li>the file still exists even if it is not displayed<\/li>\n<\/ul>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"What_is_htaccess_most_commonly_used_for\"><\/span>What is .htaccess most commonly used for?<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<h3 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"1_Directory_protection\"><\/span>1. Directory protection<span class=\"ez-toc-section-end\"><\/span><\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">It can be used together with <code>.htpasswd<\/code> to restrict access to specific folders and protect them with authentication.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"2_Redirects\"><\/span>2. Redirects<span class=\"ez-toc-section-end\"><\/span><\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">It is commonly used to create redirects between URLs or domains.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Example:<br>Redirect 301 \/old-page \/new-page<\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"3_PHP_configuration_adjustments\"><\/span>3. PHP configuration adjustments<span class=\"ez-toc-section-end\"><\/span><\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Depending on server configuration, it may be used to adjust:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>memory limits<\/li>\n\n\n\n<li>file upload size<\/li>\n\n\n\n<li>script execution time<\/li>\n<\/ul>\n\n\n\n<h3 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"4_Caching_rules\"><\/span>4. Caching rules<span class=\"ez-toc-section-end\"><\/span><\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">It can define rules that enable caching mechanisms such as LiteSpeed Cache when supported by the environment.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"5_Error_logging_and_debugging\"><\/span>5. Error logging and debugging<span class=\"ez-toc-section-end\"><\/span><\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">It can be used to enable PHP error reporting and store logs for troubleshooting purposes.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"6_HTTPS_redirection\"><\/span>6. HTTPS redirection<span class=\"ez-toc-section-end\"><\/span><\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">It can force all traffic to use HTTPS, ensuring secure connections:<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">RewriteEngine On<br>RewriteCond %{HTTPS} !=on<br>RewriteRule ^ https:\/\/%{HTTP_HOST}%{REQUEST_URI} [L,R=301]<\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"7_Directory_listing_protection\"><\/span>7. Directory listing protection<span class=\"ez-toc-section-end\"><\/span><\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">It can prevent users from viewing file lists in a directory when no index file is present.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"Practical_implications\"><\/span>Practical implications<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Changes in <code>.htaccess<\/code> take effect immediately<\/li>\n\n\n\n<li>Incorrect rules can break website functionality<\/li>\n\n\n\n<li>Rules apply recursively to subdirectories unless overridden<\/li>\n\n\n\n<li>It is a powerful but sensitive configuration file<\/li>\n<\/ul>\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\">The <code>.htaccess<\/code> file is a server configuration file used to control redirects, security rules, and website behavior on Apache-based hosting. It applies to directories and their subdirectories and is commonly used for SEO-friendly URLs, HTTPS enforcement, and access control.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><\/p>\n<\/div>\n","protected":false},"author":1,"featured_media":0,"parent":0,"menu_order":0,"template":"","format":"standard","manualknowledgebasecat":[25,43,125],"manual_kb_tag":[516,588,718,1292,2320,4213,185,242,283,372,415],"class_list":["post-49","manual_kb","type-manual_kb","status-publish","format-standard","hentry","manualknowledgebasecat-hosting","manualknowledgebasecat-website-errors","manualknowledgebasecat-websites","manual_kb_tag-filezilla","manual_kb_tag-website","manual_kb_tag-htaccess-file","manual_kb_tag-server-configuration","manual_kb_tag-php-settings","manual_kb_tag-error-reporting","manual_kb_tag-web-browser","manual_kb_tag-mybox","manual_kb_tag-mybox-panel","manual_kb_tag-ssl-certificate","manual_kb_tag-ftp-client"],"_links":{"self":[{"href":"https:\/\/mybox.com\/help\/ro\/wp-json\/wp\/v2\/manual_kb\/49","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":2,"href":"https:\/\/mybox.com\/help\/ro\/wp-json\/wp\/v2\/manual_kb\/49\/revisions"}],"predecessor-version":[{"id":6754,"href":"https:\/\/mybox.com\/help\/ro\/wp-json\/wp\/v2\/manual_kb\/49\/revisions\/6754"}],"wp:attachment":[{"href":"https:\/\/mybox.com\/help\/ro\/wp-json\/wp\/v2\/media?parent=49"}],"wp:term":[{"taxonomy":"manualknowledgebasecat","embeddable":true,"href":"https:\/\/mybox.com\/help\/ro\/wp-json\/wp\/v2\/manualknowledgebasecat?post=49"},{"taxonomy":"manual_kb_tag","embeddable":true,"href":"https:\/\/mybox.com\/help\/ro\/wp-json\/wp\/v2\/manual_kb_tag?post=49"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}