Before URLs can be rewritten, a module called
mod_rewrite.c needs to be enabled. Usually, it is disabled in the configuration by default.
mod_rewrite can be enabled by executing the command
$ sudo a2enmod mod_rewrite
$ sudo service apache2 restart
or by commenting out the lines
#LoadModule rewrite_module modules/mod_rewrite.so