Activate .htaccess in Apache
The .htaccess file is a configuration file you can enable on a Apache Web Server. when the .htaccess file is placed in a root directory and loaded by the apache server, then the configuration you have set in the file will override the main Apache configuration for the individual host, so that means you can use .htaccess files in different hosts and the configuration will be different from each hosts. for an example you can set different configurations in the .htaccess file such as, domain/ip blocking, password protection or image hot link prevention. you can take a look here to see more.
Step 1. Enable rewrite module
you should enable the rewrite module in Apache by using this command
sudo a2enmod rewrite && sudo service apache2 restart
Step 2. Acitivate .htacces file Apache
You should open your Apache conf. file for the host you want to use .htacces file on.
sudo nano /etc/apache2//sites-available 000-default.conf
You will see this :
Change it to
sudo service apache2 restart
And you should have .htaccess activated now