File wp-config.php is the most important component of WordPress enabled websites as well as its security system. To manage this file, you need some knowledge. After reading this article, you can configure WordPress and know how to take advantage of the benefits of wp-config file.

What is wp-config.php file?

First and foremost, you need to know what wp-config.php is . This file contains WordPress configuration information and most importantly, information of the website’s database connection. This information includes: database name, username, password and database host.

The wp-config.php file is not available in WordPress but it was created during WordPress installation. It is a separate file of the website.

Now you want to know where wp-config.php is? The location of this file is located in the root directory of the website. Usually and in this example it is located in / public_html .

Where is wp-config.php

To edit the wp-config.php file, you can use FTP (for example, FileZilla ), or if you’re using Hostinger, it’s easier to use File Manager. The next step is to download this file.

Important: Edit the wp-config.php file as needed and don’t forget to save a copy of this file. If incorrect correction can cause serious error.

When you open the wp-config.php file , in the root directory of WordPress installation, you will see the following code:

  1. <? php
  2. / **
  3. * The base configuration for WordPress
  4. *
  5. * The wp-config.php creation script uses this file during the
  6. * installation. Bạn không có thể sử dụng site, bạn có thể
  7. * copy the file to “wp-config.php” and fill in the values.
  8. *
  9. * Tập tin này chứa những các hình này:
  10. *
  11. * * MySQL settings
  12. * * Secret keys
  13. * * Database table prefix
  14. * * ABSPATH
  15. *
  16. * @link https://codex.wordpress.org/Editing_wp-config.php
  17. *
  18. * @package WordPress
  19. * /
  20. // ** MySQL settings – You can get this info from web host ** //
  21. / ** The name of the database for WordPress * /
  22. define ( ‘DB_NAME’ , ‘database_name_here’ ) ;
  23. / ** MySQL database username * /
  24. define ( ‘DB_USER’ , ‘username_here’ ) ;
  25. / ** MySQL database password * /
  26. define ( ‘DB_PASSWORD’ , ‘password_here’ ) ;
  27. / ** MySQL hostname * /
  28. define ( ‘DB_HOST’ , ‘localhost’ ) ;
  29. / ** Database Charset to use in creating tables database. * /
  30. define ( ‘DB_CHARSET’ , ‘utf8’ ) ;
  31. / ** The Database Collate type. Không thay đổi này để xác thực * /
  32. define ( ‘DB_COLLATE’ , ) ;
  33. / ** # @ +
  34. * Authentication Unique Keys and Salts.
  35. *
  36. * Change these to different unique phrases!
  37. * You can generate these using the {@link https://api.wordpress.org/secret-key/1.1/salt/ WordPress.org secret-key service}
  38. * Bạn có thể thay đổi các này trong một thời gian trong thời gian để không hợp lệ tất cả các cookie đã có. Đây sẽ không đúng, người dùng để đăng nhập sau.
  39. *
  40. * @since 2.6.0
  41. * /
  42. define ( ‘AUTH_KEY’ , ‘put your unique phrase here’ ) ;
  43. define ( ‘SECURE_AUTH_KEY’ , ‘put your unique phrase here’ ) ;
  44. define ( ‘LOGGED_IN_KEY’ , ‘put your unique phrase here’ ) ;
  45. define ( ‘NONCE_KEY’ , ‘put your unique phrase here’ ) ;
  46. define ( ‘AUTH_SALT’ , ‘put your unique phrase here’ ) ;
  47. define ( ‘SECURE_AUTH_SALT’ , ‘put your unique phrase here’ ) ;
  48. define ( ‘LOGGED_IN_SALT’ , ‘put your unique phrase here’ ) ;
  49. define ( ‘NONCE_SALT’ , ‘put your unique phrase here’ ) ;
  50. / ** # @ – * /
  51. / **
  52. * WordPress Database Table prefix.
  53. *
  54. * You can have multiple installations in one database if you give each
  55. * a unique prefix. Only numbers, letters, and underscores please!
  56. * /
  57. $ table_prefix = ‘wp_’ ;
  58. / **
  59. * For developers: WordPress debugging mode.
  60. *
  61. * Change this to true to enable display of notices during development.
  62. * It is strongly recommended that plugin and theme use WP_DEBUG
  63. * in their development environments.
  64. *
  65. * Không tìm thấy thông tin trên các số khác nhau, cần dùng để gỡ lỗi,
  66. * visit the Codex.
  67. *
  68. * @link https://codex.wordpress.org/Debugging_in_WordPress
  69. * /
  70. define ( ‘WP_DEBUG’ , false ) ;
  71. / * That’s all, stop editing! Happy blogging. * /
  72. / ** Absolute path to the WordPress directory. * /
  73. if ( ! defined ( ‘ABSPATH’ ) )
  74. define ( ‘ABSPATH’ , dirname ( __FILE__ ) . ‘/’ ) ;
  75. / ** Sets up WordPress vars and included files. * /
  76. require_once ( ABSPATH. ‘wp-settings.php’ ) ;

MySQL database connection information in wp-config.php

Database configuration information is written under the MySQL settings section in the wp-config.php file, containing information including: MySQL hostname, database name, username, and password. You can change this information when you move the website to another provider and need to update the MySQL database. This is its snippet:

  1. // ** MySQL settings – You can get this info from web host ** //
  2. / ** The name of the database for WordPress * /
  3. define ( ‘DB_NAME’ , ‘database_name_here’ ) ;
  4. / ** MySQL database username * /
  5. define ( ‘DB_USER’ , ‘username_here’ ) ;
  6. / ** MySQL database password * /
  7. define ( ‘DB_PASSWORD’ , ‘password_here’ ) ;
  8. / ** MySQL hostname * /
  9. define ( ‘DB_HOST’ , ‘localhost’ ) ;

To get this information, you can find it in the control panel of web hosting. Just log in your account, click on the Database button, and select the MySQL database. It will look like this in Hostinger’s control panel:

Database connection information in control panel

In addition to configuring the database, you can do many other things with the wp-config file to customize your website. You can create Authentication Key and Salts, change table prefix, enable debugging mode, and move the file to another location to make it safer. We will go through it one by one.

Security keys

The wp-config.php file is important because it creates Authentication Keys and internal Salts. This information will help protect your website because it encrypts user information.

To create Authentication keys and Salts, you need to create a series of strong passwords first. You can create a series of strong passwords using the WordPress password generator . After having a list of passwords, paste them one by one into the file to replace the ‘enter password here’.

  1. / ** # @ +
  2. * Authentication Unique Keys and Salts.
  3. *
  4. * Change these to different unique phrases!
  5. * You can generate these using the {@link https://api.wordpress.org/secret-key/1.1/salt/ WordPress.org secret-key service}
  6. * Bạn có thể thay đổi các này trong một thời gian trong thời gian để không hợp lệ tất cả các cookie đã có. Đây sẽ không đúng, người dùng để đăng nhập sau.
  7. *
  8. * @since 2.6.0
  9. * /
  10. define ( ‘AUTH_KEY’ , ‘enter the password here’ ) ;
  11. define ( ‘SECURE_AUTH_KEY’ , ‘enter password here’ ) ;
  12. define ( ‘LOGGED_IN_KEY’ , ‘enter password here’ ) ;
  13. define ( ‘NONCE_KEY’ , ‘enter the password here’ ) ;
  14. define ( ‘AUTH_SALT’ , ‘enter password here’ ) ;
  15. define ( ‘SECURE_AUTH_SALT’ , ‘enter password here’ ) ;
  16. define ( ‘LOGGED_IN_SALT’ , ‘enter password here’ ) ;
  17. define ( ‘NONCE_SALT’ , ‘enter password here’ ) ;
  18. / ** # @ – * /

The effect of this method is very strong, it will exit all users who are logged in and make the existing cookies no longer available. This way, the hackers who get your password will automatically get out.

Database Table Prefix

WordPress by default names the table with the prefix ‘wp_’ in the wp-config.php file, so you can increase security by fixing it to another name. Initial information is:

  1. $ table_prefix = ‘wp_’ ;

Change the prefix information during the installation process to make it safer. Replace the default prefix with a different name to restrict SQL injection attacks.

Change wp prefix with a certain character. Note that you can only use underscores, letters, and numbers. Examples are as follows:

  1. $ table_prefix = ‘wp_custom751Admin_’ ;

Create a complex prefix that is best. Otherwise, creating a prefix that is too easy to guess will have no effect.

Debugging Mode

By default, debugging mode will be disabled. Turn it on if you like learning about the WordPress development process.

Debugging mode is used to inform the developer after the code is executed. It will help find errors on the website. This function is also very useful for ordinary users, which can help them fix basic errors.

To turn on debugging mode, you just need to find the following line, replacing the value to True at False where it is:

  1. define ( ‘WP_DEBUG’ , false ) ;

Where is Wp-config and how to change the location of wp-config.php file

The initial location of the wp-config.php file is in the root directory of WordPress installation, usually in the public_html directory. Changing the location of the wp-config.php file can be dangerous for the website, so remember to back up the website first. Changing the location of the wp-config.php file is a great way to help hackers find it easily. An extremely effective security step.

Change the path to wp-config.php, open the FTP client (or use Hostinger File Manager) and follow these instructions:

  1. Find wp-config.php in the root directory of the website.
  2. Move the wp-config.php file to another location by dragging it to the desired folder. ee tới một thư mục khác, hoặc bỏ bỏ nó vào thư mục của bạn. The more unusual the position, the better. In this file, we put it in / public_html / wp-admin / user
    change the location of wp-config.php file
  3. After that, the website will no longer be accessible because it cannot find the wp-config file in the old location anymore. You will need to create a new wp-config.php file on your computer’s editor (notepad, for example), with the following content:
    1. <? php
    2. include ( ‘/ domains / hostinger-dev- 9 .xyz / public_html / wp-admin / user’ ) ;
    3. ?>

    Note that you need to edit the path of the wp-config.php file in the example above so you save the wp-config.php file correctly .

  4. Upload this new file to your root directory, where the old wp-config.php file is located. Override if the old file wp-config.php is still there.
  5. It is done. You have configured WordPress more securely with a simple operation.

Epilogue

You already know how important wp-config.php is to WordPress. It contains extremely sensitive information, so you need to keep it away from anyone with bad intentions. There are many ways to help you do this, but remember to be extremely careful when adjusting the wp-config file. Otherwise you will not be able to access the WordPress website anymore or damage the website.

Read more :
All you need to know about wp-config.php

File wp-config.php is the most important component of WordPress enabled websites as well as its security system. To manage this file, you need some knowled

Editor's Rating:
5
READ  Cara Memecah Posting yang Lebih Lama Menjadi Beberapa Halaman di Blogger

Leave a Reply

Your email address will not be published. Required fields are marked *