{"id":12305,"date":"2021-11-05T06:48:29","date_gmt":"2021-11-05T06:48:29","guid":{"rendered":"https:\/\/www.milesweb.co.uk\/hosting-faqs\/?p=12305"},"modified":"2024-04-23T12:00:03","modified_gmt":"2024-04-23T11:00:03","slug":"deny-access-htaccess-file-cpanel","status":"publish","type":"post","link":"https:\/\/www.milesweb.co.uk\/hosting-faqs\/deny-access-htaccess-file-cpanel\/","title":{"rendered":"How  to Deny Access to .htaccess File using cPanel?"},"content":{"rendered":"<p>The .htaccess files are vital hidden files of your hosting and, we recommend protecting them with .htaccess rules. One way to do so is to deny access to the .htaccess file via cPanel File Manager.<\/p>\n<h2>To Deny Access to .htaccess File<\/h2>\n<p>1. Log in to your cPanel account.<\/p>\n<p>2. Open <strong>File Manager<\/strong> and edit the <strong>.htaccess<\/strong> file.<\/p>\n<p>Here&#8217;s an article that explains:\u00a0<a href=\"https:\/\/www.milesweb.co.uk\/hosting-faqs\/how-to-edit-a-htaccess-file-through-the-cpanel-file-manager\/\">How To Edit A .htaccess File Through The cPanel File Manager?<\/a><\/p>\n<p>3. Add this code at the end of the file:<\/p>\n<pre class=\"font-size:15 line-height:20 lang:default decode:true\"># Deny access to hidden files - files that start with a dot (.)\n&lt;FilesMatch \"^\\.\"&gt;\nOrder allow,deny\nDeny from all<\/pre>\n<p>4. Click <strong>Save Changes<\/strong> and <strong>Close<\/strong> the file.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-12308\" src=\"https:\/\/www.milesweb.co.uk\/hosting-faqs\/wp-content\/uploads\/2021\/11\/cp_htaccess_deny_access.jpg\" alt=\"\" width=\"1599\" height=\"535\" srcset=\"https:\/\/www.milesweb.co.uk\/hosting-faqs\/wp-content\/uploads\/2021\/11\/cp_htaccess_deny_access.jpg 1599w, https:\/\/www.milesweb.co.uk\/hosting-faqs\/wp-content\/uploads\/2021\/11\/cp_htaccess_deny_access-300x100.jpg 300w, https:\/\/www.milesweb.co.uk\/hosting-faqs\/wp-content\/uploads\/2021\/11\/cp_htaccess_deny_access-768x257.jpg 768w, https:\/\/www.milesweb.co.uk\/hosting-faqs\/wp-content\/uploads\/2021\/11\/cp_htaccess_deny_access-1024x343.jpg 1024w\" sizes=\"auto, (max-width: 1599px) 100vw, 1599px\" \/><\/p>\n<p>If you own a VPS or a dedicated server, you can protect the .htaccess\/hidden files on all the sites on it.\u00a0You have to edit the <em>\/home\/.htaccess<\/em> file and enter the code there.<\/p>\n<div class=\"kb-wisdom-wrapr kb-wisdom-info\">\n<div class=\"kb-wisdom-col kb-wisdom-col-icon\">\n<div class=\"kb-wisdom-icon\">\n<div><\/div>\n<\/div>\n<\/div>\n<div class=\"kb-wisdom-col kb-wisdom-col-content\">\n<p><strong>Note<\/strong>: If you are an admin, it is still possible to edit the .htaccess file via FTP\/control panel File Manager, even after you have entered the code to deny access.<\/p>\n<\/div>\n<\/div>\n","protected":false},"excerpt":{"rendered":"<p>The .htaccess files are vital hidden files of your hosting and, we recommend protecting them with .htaccess rules. One way to do so is to deny access to the .htaccess file via cPanel File Manager. To Deny Access to .htaccess File 1. Log in to your cPanel account. 2. Open File Manager and edit the [&hellip;]<\/p>\n","protected":false},"author":27,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[9,41],"tags":[649,608,609,2658,2656,1400,2657],"class_list":["post-12305","post","type-post","status-publish","format-standard","placeholder-for-hentry","category-cpanel-faq","category-howtos","tag-htaccess","tag-htaccess-file","tag-create-htaccess-file","tag-create-edit-htaccess","tag-deny-access-htaccess-cpanel","tag-edit-htaccess-file","tag-protect-htaccess-file"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v25.2 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>How to Deny Access to .htaccess File using cPanel?<\/title>\n<meta name=\"description\" content=\"This article shows how you can deny access to hidden files like the .htaccess file and protect them using cPanel File Manager.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.milesweb.co.uk\/hosting-faqs\/deny-access-htaccess-file-cpanel\/\" \/>\n<meta property=\"og:locale\" content=\"en_GB\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"How to Deny Access to .htaccess File using cPanel?\" \/>\n<meta property=\"og:description\" content=\"This article shows how you can deny access to hidden files like the .htaccess file and protect them using cPanel File Manager.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.milesweb.co.uk\/hosting-faqs\/deny-access-htaccess-file-cpanel\/\" \/>\n<meta property=\"og:site_name\" content=\"Web Hosting FAQs by MilesWeb\" \/>\n<meta property=\"article:published_time\" content=\"2021-11-05T06:48:29+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2024-04-23T11:00:03+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.milesweb.co.uk\/hosting-faqs\/wp-content\/uploads\/2021\/11\/cp_htaccess_deny_access.jpg\" \/>\n<meta name=\"author\" content=\"Prasad Khartadkar\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Prasad Khartadkar\" \/>\n\t<meta name=\"twitter:label2\" content=\"Estimated reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"1 minute\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.milesweb.co.uk\/hosting-faqs\/deny-access-htaccess-file-cpanel\/\",\"url\":\"https:\/\/www.milesweb.co.uk\/hosting-faqs\/deny-access-htaccess-file-cpanel\/\",\"name\":\"How to Deny Access to .htaccess File using cPanel?\",\"isPartOf\":{\"@id\":\"https:\/\/www.milesweb.co.uk\/hosting-faqs\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/www.milesweb.co.uk\/hosting-faqs\/deny-access-htaccess-file-cpanel\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/www.milesweb.co.uk\/hosting-faqs\/deny-access-htaccess-file-cpanel\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/www.milesweb.co.uk\/hosting-faqs\/wp-content\/uploads\/2021\/11\/cp_htaccess_deny_access.jpg\",\"datePublished\":\"2021-11-05T06:48:29+00:00\",\"dateModified\":\"2024-04-23T11:00:03+00:00\",\"author\":{\"@id\":\"https:\/\/www.milesweb.co.uk\/hosting-faqs\/#\/schema\/person\/c9138a9488172a8d0aa2d4f40878d83e\"},\"description\":\"This article shows how you can deny access to hidden files like the .htaccess file and protect them using cPanel File Manager.\",\"breadcrumb\":{\"@id\":\"https:\/\/www.milesweb.co.uk\/hosting-faqs\/deny-access-htaccess-file-cpanel\/#breadcrumb\"},\"inLanguage\":\"en-GB\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.milesweb.co.uk\/hosting-faqs\/deny-access-htaccess-file-cpanel\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-GB\",\"@id\":\"https:\/\/www.milesweb.co.uk\/hosting-faqs\/deny-access-htaccess-file-cpanel\/#primaryimage\",\"url\":\"https:\/\/www.milesweb.co.uk\/hosting-faqs\/wp-content\/uploads\/2021\/11\/cp_htaccess_deny_access.jpg\",\"contentUrl\":\"https:\/\/www.milesweb.co.uk\/hosting-faqs\/wp-content\/uploads\/2021\/11\/cp_htaccess_deny_access.jpg\",\"width\":1599,\"height\":535},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.milesweb.co.uk\/hosting-faqs\/deny-access-htaccess-file-cpanel\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/www.milesweb.co.uk\/hosting-faqs\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"How to Deny Access to .htaccess File using cPanel?\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.milesweb.co.uk\/hosting-faqs\/#website\",\"url\":\"https:\/\/www.milesweb.co.uk\/hosting-faqs\/\",\"name\":\"Web Hosting FAQs by MilesWeb\",\"description\":\"\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.milesweb.co.uk\/hosting-faqs\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-GB\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.milesweb.co.uk\/hosting-faqs\/#\/schema\/person\/c9138a9488172a8d0aa2d4f40878d83e\",\"name\":\"Prasad Khartadkar\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-GB\",\"@id\":\"https:\/\/www.milesweb.co.uk\/hosting-faqs\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/fafb102a39aa8f8d38a11f3e2dcfa746?s=96&d=blank&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/fafb102a39aa8f8d38a11f3e2dcfa746?s=96&d=blank&r=g\",\"caption\":\"Prasad Khartadkar\"},\"description\":\"Prasad is a business grad specialized in Marketing. He has garnered experience as a technical content writer and a digital marketer that he brings out in his work. He likes reading classics and travel in his free time.\",\"url\":\"https:\/\/www.milesweb.co.uk\/hosting-faqs\/author\/prasad-khartadkar\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"How to Deny Access to .htaccess File using cPanel?","description":"This article shows how you can deny access to hidden files like the .htaccess file and protect them using cPanel File Manager.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.milesweb.co.uk\/hosting-faqs\/deny-access-htaccess-file-cpanel\/","og_locale":"en_GB","og_type":"article","og_title":"How to Deny Access to .htaccess File using cPanel?","og_description":"This article shows how you can deny access to hidden files like the .htaccess file and protect them using cPanel File Manager.","og_url":"https:\/\/www.milesweb.co.uk\/hosting-faqs\/deny-access-htaccess-file-cpanel\/","og_site_name":"Web Hosting FAQs by MilesWeb","article_published_time":"2021-11-05T06:48:29+00:00","article_modified_time":"2024-04-23T11:00:03+00:00","og_image":[{"url":"https:\/\/www.milesweb.co.uk\/hosting-faqs\/wp-content\/uploads\/2021\/11\/cp_htaccess_deny_access.jpg","type":"","width":"","height":""}],"author":"Prasad Khartadkar","twitter_misc":{"Written by":"Prasad Khartadkar","Estimated reading time":"1 minute"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/www.milesweb.co.uk\/hosting-faqs\/deny-access-htaccess-file-cpanel\/","url":"https:\/\/www.milesweb.co.uk\/hosting-faqs\/deny-access-htaccess-file-cpanel\/","name":"How to Deny Access to .htaccess File using cPanel?","isPartOf":{"@id":"https:\/\/www.milesweb.co.uk\/hosting-faqs\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.milesweb.co.uk\/hosting-faqs\/deny-access-htaccess-file-cpanel\/#primaryimage"},"image":{"@id":"https:\/\/www.milesweb.co.uk\/hosting-faqs\/deny-access-htaccess-file-cpanel\/#primaryimage"},"thumbnailUrl":"https:\/\/www.milesweb.co.uk\/hosting-faqs\/wp-content\/uploads\/2021\/11\/cp_htaccess_deny_access.jpg","datePublished":"2021-11-05T06:48:29+00:00","dateModified":"2024-04-23T11:00:03+00:00","author":{"@id":"https:\/\/www.milesweb.co.uk\/hosting-faqs\/#\/schema\/person\/c9138a9488172a8d0aa2d4f40878d83e"},"description":"This article shows how you can deny access to hidden files like the .htaccess file and protect them using cPanel File Manager.","breadcrumb":{"@id":"https:\/\/www.milesweb.co.uk\/hosting-faqs\/deny-access-htaccess-file-cpanel\/#breadcrumb"},"inLanguage":"en-GB","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.milesweb.co.uk\/hosting-faqs\/deny-access-htaccess-file-cpanel\/"]}]},{"@type":"ImageObject","inLanguage":"en-GB","@id":"https:\/\/www.milesweb.co.uk\/hosting-faqs\/deny-access-htaccess-file-cpanel\/#primaryimage","url":"https:\/\/www.milesweb.co.uk\/hosting-faqs\/wp-content\/uploads\/2021\/11\/cp_htaccess_deny_access.jpg","contentUrl":"https:\/\/www.milesweb.co.uk\/hosting-faqs\/wp-content\/uploads\/2021\/11\/cp_htaccess_deny_access.jpg","width":1599,"height":535},{"@type":"BreadcrumbList","@id":"https:\/\/www.milesweb.co.uk\/hosting-faqs\/deny-access-htaccess-file-cpanel\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.milesweb.co.uk\/hosting-faqs\/"},{"@type":"ListItem","position":2,"name":"How to Deny Access to .htaccess File using cPanel?"}]},{"@type":"WebSite","@id":"https:\/\/www.milesweb.co.uk\/hosting-faqs\/#website","url":"https:\/\/www.milesweb.co.uk\/hosting-faqs\/","name":"Web Hosting FAQs by MilesWeb","description":"","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.milesweb.co.uk\/hosting-faqs\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-GB"},{"@type":"Person","@id":"https:\/\/www.milesweb.co.uk\/hosting-faqs\/#\/schema\/person\/c9138a9488172a8d0aa2d4f40878d83e","name":"Prasad Khartadkar","image":{"@type":"ImageObject","inLanguage":"en-GB","@id":"https:\/\/www.milesweb.co.uk\/hosting-faqs\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/fafb102a39aa8f8d38a11f3e2dcfa746?s=96&d=blank&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/fafb102a39aa8f8d38a11f3e2dcfa746?s=96&d=blank&r=g","caption":"Prasad Khartadkar"},"description":"Prasad is a business grad specialized in Marketing. He has garnered experience as a technical content writer and a digital marketer that he brings out in his work. He likes reading classics and travel in his free time.","url":"https:\/\/www.milesweb.co.uk\/hosting-faqs\/author\/prasad-khartadkar\/"}]}},"views":389,"_links":{"self":[{"href":"https:\/\/www.milesweb.co.uk\/hosting-faqs\/wp-json\/wp\/v2\/posts\/12305","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.milesweb.co.uk\/hosting-faqs\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.milesweb.co.uk\/hosting-faqs\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.milesweb.co.uk\/hosting-faqs\/wp-json\/wp\/v2\/users\/27"}],"replies":[{"embeddable":true,"href":"https:\/\/www.milesweb.co.uk\/hosting-faqs\/wp-json\/wp\/v2\/comments?post=12305"}],"version-history":[{"count":4,"href":"https:\/\/www.milesweb.co.uk\/hosting-faqs\/wp-json\/wp\/v2\/posts\/12305\/revisions"}],"predecessor-version":[{"id":15367,"href":"https:\/\/www.milesweb.co.uk\/hosting-faqs\/wp-json\/wp\/v2\/posts\/12305\/revisions\/15367"}],"wp:attachment":[{"href":"https:\/\/www.milesweb.co.uk\/hosting-faqs\/wp-json\/wp\/v2\/media?parent=12305"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.milesweb.co.uk\/hosting-faqs\/wp-json\/wp\/v2\/categories?post=12305"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.milesweb.co.uk\/hosting-faqs\/wp-json\/wp\/v2\/tags?post=12305"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}