Make sure that the server has apache rewrite module enabled. To ensure about this, you need to create a php file at there root directory of your wordpress site and lets give it a name
site_info.php. Now open the site_info.php file and add the paste the following codes:
<?php phpinfo(); ?>
Now save it and open in the browser like
https://example.com/site_info.php and find the word
mod_rewrite. If it is not enabled and you have the SSH with root permission then you can enable it by using the following command.
sudo a2enmod rewrite
And then restart the apache server with
sudo service apache2 restart command.