Go to the root directory of Drupal 9 site and change the write permission of the .htaccess file to write enable.sudo chmod 777 .htaccess
.htaccess
sudo chmod 777 .htaccess
Open .htaccess with nano commandsudo nano .htaccess
nano
sudo nano .htaccess