{"id":17448,"date":"2024-05-22T15:34:52","date_gmt":"2024-05-22T15:34:52","guid":{"rendered":"https:\/\/hostvento.com\/kb\/web-hosting\/learn-to-deny-access-to-your-wp-config-php-file-under-wordpress-installation\/"},"modified":"2024-06-17T06:27:24","modified_gmt":"2024-06-17T06:27:24","slug":"learn-to-deny-access-to-your-wp-config-php-file-under-wordpress-installation","status":"publish","type":"docs","link":"https:\/\/www.hostvento.com\/kb\/docs\/hosting-faqs\/learn-to-deny-access-to-your-wp-config-php-file-under-wordpress-installation\/","title":{"rendered":"Learn to Deny Access to Your wp-config.php File Under WordPress Installation"},"content":{"rendered":"\n<p>Is your wp-config.php file secure? You can deny access to this file by following simple steps.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Steps to Deny Access to Your wp-config.php File Under WordPress Installation<\/h3>\n\n\n\n<ol class=\"wp-block-list\">\n<li>You will find your wp-config.php in the main directory of your WordPress installation and it is used to access the database.<\/li>\n\n\n\n<li>In this file comprises of your user id, password and database name in unencrypted format.<\/li>\n\n\n\n<li>Though it might be a .php file and no one should be able to see its content from the browser, you shouldn\u2019t keep it in the main folder without doing anything about it.<\/li>\n\n\n\n<li>.htaccess in WordPress is commonly used to setup custom permalink for better SEO optimization. But you can utilize .htaccess to minimize vulnerability of your site.<\/li>\n\n\n\n<li>It is good to update your .htaccess to deny access to it. Here, files directive can be used to deny access to certain files. This directive can be used for any file on your website.<\/li>\n\n\n\n<li>Simply add the below code to your .htaccess present under the www directory:<\/li>\n<\/ol>\n\n\n\n<pre class=\"wp-block-preformatted\"># to protect wp-config.php\n&lt;Files wp-config.php&gt;\norder allow,deny\ndeny from all\n&lt;\/Files&gt;<\/pre>\n\n\n\n<p>Here \u201cdeny all\u201d will deny the access to wp-config.php for all.<\/p>\n\n\n\n<p><strong><a href=\"https:\/\/hostvento.com\/kb\/web-hosting\/how-to-change-domain-nameservers-dns-of-my-domain\/\" target=\"_blank\" rel=\"noopener\">How to change Domain Nameservers (DNS) of my Domain?<\/a><\/strong><\/p>\n\n\n\n<p><a href=\"https:\/\/hostvento.com\/kb\/web-hosting\/learn-to-install-hyper-v-role-on-windows-server-2008\/\" target=\"_blank\" rel=\"noopener\"><strong>Learn to install Hyper-V role on Windows Server 2008<\/strong><\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Is your wp-config.php file secure? You can deny access to this file by following simple steps. Steps to Deny Access to Your wp-config.php File Under WordPress Installation # to protect wp-config.php &lt;Files wp-config.php&gt; order allow,deny deny from all &lt;\/Files&gt; Here \u201cdeny all\u201d will deny the access to wp-config.php for all. How to change Domain Nameservers [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"parent":23377,"menu_order":817,"comment_status":"closed","ping_status":"closed","template":"","doc_tag":[],"class_list":["post-17448","docs","type-docs","status-publish","hentry","no-post-thumbnail"],"acf":[],"_links":{"self":[{"href":"https:\/\/www.hostvento.com\/kb\/wp-json\/wp\/v2\/docs\/17448","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.hostvento.com\/kb\/wp-json\/wp\/v2\/docs"}],"about":[{"href":"https:\/\/www.hostvento.com\/kb\/wp-json\/wp\/v2\/types\/docs"}],"author":[{"embeddable":true,"href":"https:\/\/www.hostvento.com\/kb\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.hostvento.com\/kb\/wp-json\/wp\/v2\/comments?post=17448"}],"version-history":[{"count":3,"href":"https:\/\/www.hostvento.com\/kb\/wp-json\/wp\/v2\/docs\/17448\/revisions"}],"predecessor-version":[{"id":20589,"href":"https:\/\/www.hostvento.com\/kb\/wp-json\/wp\/v2\/docs\/17448\/revisions\/20589"}],"up":[{"embeddable":true,"href":"https:\/\/www.hostvento.com\/kb\/wp-json\/wp\/v2\/docs\/23377"}],"wp:attachment":[{"href":"https:\/\/www.hostvento.com\/kb\/wp-json\/wp\/v2\/media?parent=17448"}],"wp:term":[{"taxonomy":"doc_tag","embeddable":true,"href":"https:\/\/www.hostvento.com\/kb\/wp-json\/wp\/v2\/doc_tag?post=17448"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}