This points to an issue with .htaccess
. Going to Settings->Permalinks
will recreate .htaccess
, and so I think that it could be an issue with file permissions during your load or maybe because it’s a dot file the server could be treating the file differently and somehow deleting it?
This maybe useful :
I have a routine that runs flush_rewrite_rules(true)
on deployment of my theme. I use wp-cli
(https://wp-cli.org/) to trigger this:
// in functions.php (using closures)
add_action('cli_init', function () {
WP_CLI::add_command('deploy', function () {
flush_rewrite_rules(true);
// do something else.
});
});
As part of my deployment process I use the following commands in my CI/CD process
cd \path\to\wp_root
php wp-cli.phar deploy
That way your .htaccess
file will be recreated every time your deploy.