{"id":11922,"date":"2026-05-20T06:38:04","date_gmt":"2026-05-20T06:38:04","guid":{"rendered":"https:\/\/www.webystrata.co.uk\/blog\/?p=11922"},"modified":"2026-06-05T05:03:45","modified_gmt":"2026-06-05T05:03:45","slug":"deny-access-htaccess-file-in-cpanel","status":"publish","type":"post","link":"https:\/\/www.webystrata.co.uk\/blog\/deny-access-htaccess-file-in-cpanel\/","title":{"rendered":"How to Deny Access to .htaccess File in cPanel"},"content":{"rendered":"<h3 data-section-id=\"ihov1b\" data-start=\"362\" data-end=\"407\">Steps to Deny Access to the .htaccess File<\/h3>\n<h4 data-section-id=\"1on9ls4\" data-start=\"409\" data-end=\"445\">1. Log in to Your cPanel Account<\/h4>\n<p data-start=\"446\" data-end=\"506\">Access your cPanel using your hosting username and password.<\/p>\n<h4 data-section-id=\"enqo9n\" data-start=\"513\" data-end=\"537\">2. Open File Manager<\/h4>\n<ul data-start=\"538\" data-end=\"639\">\n<li data-section-id=\"t6ve34\" data-start=\"538\" data-end=\"568\">Go to the <strong data-start=\"550\" data-end=\"559\">FILES<\/strong> section.<\/li>\n<li data-section-id=\"1ovrw0s\" data-start=\"569\" data-end=\"597\">Click on <strong data-start=\"580\" data-end=\"596\">File Manager<\/strong>.<\/li>\n<li data-section-id=\"2zwx9i\" data-start=\"598\" data-end=\"639\">Locate your website\u2019s <code data-start=\"622\" data-end=\"633\">.htaccess<\/code> file.<\/li>\n<\/ul>\n<blockquote data-start=\"641\" data-end=\"714\">\n<p data-start=\"643\" data-end=\"714\">Make sure hidden files (dotfiles) are enabled in File Manager settings.<\/p>\n<\/blockquote>\n<h4 data-section-id=\"1pnd25q\" data-start=\"721\" data-end=\"751\">3. Edit the .htaccess File<\/h4>\n<ul data-start=\"752\" data-end=\"805\">\n<li data-section-id=\"g6llm4\" data-start=\"752\" data-end=\"787\">Right-click the <code data-start=\"770\" data-end=\"781\">.htaccess<\/code> file.<\/li>\n<li data-section-id=\"rlgtys\" data-start=\"788\" data-end=\"805\">Click <strong data-start=\"796\" data-end=\"804\">Edit<\/strong>.<\/li>\n<\/ul>\n<p data-start=\"807\" data-end=\"853\">Add the following code at the end of the file:<\/p>\n<p data-start=\"807\" data-end=\"853\"># Deny access to hidden files &#8211; files that start with a dot (.)<br \/>\n&lt;FilesMatch &#8220;^\\.&#8221;&gt;<br \/>\nOrder allow,deny<br \/>\nDeny from all<br \/>\n&lt;\/FilesMatch&gt;<\/p>\n<p data-start=\"807\" data-end=\"853\"><a href=\"https:\/\/www.webystrata.co.uk\/blog\/wp-content\/uploads\/2026\/05\/htaccess-file-deny-1.png\"><img fetchpriority=\"high\" decoding=\"async\" class=\"aligncenter wp-image-11923 size-large\" src=\"https:\/\/www.webystrata.co.uk\/blog\/wp-content\/uploads\/2026\/05\/htaccess-file-deny-1024x458-1.png\" alt=\"deny-access-htaccess-file-cpanel\" width=\"640\" height=\"286\" \/><\/a><\/p>\n<h4 data-section-id=\"1v6m4x4\" data-start=\"1003\" data-end=\"1022\">4. Save Changes<\/h4>\n<ul data-start=\"1023\" data-end=\"1066\">\n<li data-section-id=\"r4g582\" data-start=\"1023\" data-end=\"1047\">Click <strong data-start=\"1031\" data-end=\"1047\">Save Changes<\/strong><\/li>\n<li data-section-id=\"jybo4m\" data-start=\"1048\" data-end=\"1066\">Close the editor<\/li>\n<\/ul>\n<p data-start=\"1068\" data-end=\"1140\">Your hidden files will now be protected from unauthorized public access.<\/p>\n<p class=\"ws-crosspost-source\">Originally published on <a href=\"https:\/\/www.webystrata.com\/blog\/deny-access-htaccess-file-in-cpanel\/\" target=\"_blank\" rel=\"noopener\">WebyStrata.com Blog<\/a>.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Steps to Deny Access to the .htaccess File 1. Log in to Your cPanel Account Access your cPanel using your hosting username and password. 2. Open File Manager Go to the FILES section. Click on File Manager. Locate your website\u2019s .htaccess file. Make sure hidden files (dotfiles) are enabled in File Manager settings. 3. Edit [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":12397,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[2,1],"tags":[],"class_list":["post-11922","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-cpanel","category-latest-updates"],"_links":{"self":[{"href":"https:\/\/www.webystrata.co.uk\/blog\/wp-json\/wp\/v2\/posts\/11922","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.webystrata.co.uk\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.webystrata.co.uk\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.webystrata.co.uk\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.webystrata.co.uk\/blog\/wp-json\/wp\/v2\/comments?post=11922"}],"version-history":[{"count":4,"href":"https:\/\/www.webystrata.co.uk\/blog\/wp-json\/wp\/v2\/posts\/11922\/revisions"}],"predecessor-version":[{"id":12396,"href":"https:\/\/www.webystrata.co.uk\/blog\/wp-json\/wp\/v2\/posts\/11922\/revisions\/12396"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.webystrata.co.uk\/blog\/wp-json\/wp\/v2\/media\/12397"}],"wp:attachment":[{"href":"https:\/\/www.webystrata.co.uk\/blog\/wp-json\/wp\/v2\/media?parent=11922"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.webystrata.co.uk\/blog\/wp-json\/wp\/v2\/categories?post=11922"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.webystrata.co.uk\/blog\/wp-json\/wp\/v2\/tags?post=11922"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}