问题原文
原帖链接 · Stickers · CC BY-SA 3.0
I recently signed up a hosting package, and installed WordPress from the control panel. I noticed there is wp-cli.yml in the web root folder. The file contains:
apache_modules:
- mod_rewrite
Can I ask what is it for? Is it a good idea to leave it there even if I might never use it?
社区高分解答
原帖链接 · SherylHohman · CC BY-SA 4.0
It is used by wp-cli, the command line interface for WordPress.
The wp-cli.yml is where you set configuration values, related to your website, for wp-cli.php to use.
https://make.wordpress.org/cli/handbook/config/
For example, to update "pretty links" from the command line (wp rewrite flush), the wp-cli.yml (or a config.yml) file is necessary for the command to work properly.
From the docs:
wp rewrite flushflushes rewrite rules.
Resets WordPress’ rewrite rules based on registered post types, etc.
To regenerate a.htaccessfile with WP-CLI, you’ll need to add themod_rewritemodule to yourwp-cli.ymlorconfig.yml.
For example:
apache_modules: - mod_rewrite
Flushing and Re-saving permalinks is often needed when changing themes, or if you change the installation folder for your WordPress files.
摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。
