{"id":619,"date":"2012-12-15T13:05:16","date_gmt":"2012-12-15T13:05:16","guid":{"rendered":"http:\/\/techblog.vifashion.vn\/?p=25"},"modified":"2012-12-15T13:05:16","modified_gmt":"2012-12-15T13:05:16","slug":"how-to-protect-the-wordpress-wp-config-php-file-and-other-files-as-well","status":"publish","type":"post","link":"http:\/\/ndthanh.com\/how-to-protect-the-wordpress-wp-config-php-file-and-other-files-as-well\/","title":{"rendered":"How to Protect the wordpress wp-config.php File"},"content":{"rendered":"

The wp-config.php file contains very sensitive information about your\u00a0WordPress installation, including your database access, table prefix and Secret Keys.<\/p>\n

The wp-config.php file is a standard part of your WordPress installation. It defines the configuration settings required to access your MySQL database. If your self-hosting WordPress, there’s no way of getting around not using it.<\/p>\n

It’s your job to protect it! You certainly don’t want this file falling into the wrong hands in the event of a server problem. You can protect it by encrypting it’s content when you upload and denying access to it.
\n<\/p>\n

How to protect your WordPress wp-config.php file:<\/strong><\/p>\n

    \n
  1. Anytime you upload the wp-config.php file, and\u00a0ANY<\/strong>\u00a0directory or file to your server, you should only use SFTP or FTPES. By using either of these methods, your data is encrypted while being sent to the server.If you just upload via plain FTP, your files are seen as plain text and that’s not want you want to feed a lurking evil hacker for lunch. If you don’t know if you have SFTP or FTPES, call your hosting company and ask. I personally use FTPES on GoDaddy on one of my sites and SFTP on HostGator on another.If you don’t have SSH enabled on your hosting,\u00a0DON’T<\/strong>\u00a0run over and enable it. You will lose some downtime and your database. For now, go to Step 2 so you can at least hide it, until you have time to get it set up properly.<\/li>\n
  2. Download your .htaccess file from the server. This is located in the same section as your wp-config.php or index.php file. (If you don’t have an .htaccess file, then you will need to create one, see directions below).<\/li>\n
  3. Using a text editor, like Notepad, open your .htaccess file.<\/li>\n
  4. Copy and paste the following code into your .htaccess file to deny access to your wp-config.php file.# protect wpconfig.php
    \n<files wp-config.php>
    \norder allow,deny
    \ndeny from all
    \n<\/files>When saving your changes using “Notepad,” make sure that you change the “Save as type” dropdown to “All Files” so that it does not change your .htaccess file into a .txt file.<\/li>\n<\/ol>\n

    If you’re having a problem copying and pasting the code above, you can download our\u00a0sample here<\/a>.Please note:<\/strong>\u00a0This is just a sample. Be sure that you just copy and paste the portion to protect your wp-config into your own .htaccess file.<\/p>\n

    How to create your own .htaccess file:<\/strong><\/p>\n

      \n
    1. Open up “Notepad” on your computer.<\/li>\n
    2. Copy and paste the code to deny access to your wp-config.php file (see above).<\/li>\n
    3. Click on File > Save As ><\/li>\n
    4. Change File Name to .htaccess<\/li>\n
    5. In the “Save as type” dropdown, change to “All Files.”<\/li>\n
    6. Upload this file to your server in the top-level of your WordPress files are (index.php, wp-app.php, wp-config.php, etc.).<\/li>\n<\/ol>\n

      Although there are many more things that you can do to protect your WordPress website, knowing that your wp-config.php file is now more protected should give you some peace of mind. Sleep better tonight!<\/p>\n

      Source :\u00a0http:\/\/www.wpsecuritylock.com<\/p>\n","protected":false},"excerpt":{"rendered":"

      The wp-config.php file is a standard part of your WordPress installation. It defines the configuration settings required to access your MySQL database. If your self-hosting WordPress, there’s no way of getting around not using it. It’s your job to protect it! (and other files as well)<\/p>\n","protected":false},"author":1,"featured_media":81,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[57,46],"tags":[49,58,51,55],"aioseo_notices":[],"views":5,"_links":{"self":[{"href":"http:\/\/ndthanh.com\/wp-json\/wp\/v2\/posts\/619"}],"collection":[{"href":"http:\/\/ndthanh.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/ndthanh.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/ndthanh.com\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/ndthanh.com\/wp-json\/wp\/v2\/comments?post=619"}],"version-history":[{"count":0,"href":"http:\/\/ndthanh.com\/wp-json\/wp\/v2\/posts\/619\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"http:\/\/ndthanh.com\/wp-json\/"}],"wp:attachment":[{"href":"http:\/\/ndthanh.com\/wp-json\/wp\/v2\/media?parent=619"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/ndthanh.com\/wp-json\/wp\/v2\/categories?post=619"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/ndthanh.com\/wp-json\/wp\/v2\/tags?post=619"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}