The .htaccess file is not writable code example
Example: apache2 .htaccess not writable
#if only ownership issue
sudo chown www-data: .htaccess
#else correct permissions to the directory
sudo chmod -R 755 /var/www/html/yourdomainname
sudo chown -R www-data:www-data /var/www/html/yourdomainname