1. Enable url rewriting using the command,
5. Add the below line to the beginning of the .htaccess file
a2enmod rewrite2. Open the file /etc/apache2/apache2.conf and uncomment the line,
AccessFileName .htaccess3. Update the security model
<Directory /var/www>4. Create file .htaccess in web site's root folder
Options Indexes FollowSymLinks
AllowOverride All
Require all granted
</Directory>
5. Add the below line to the beginning of the .htaccess file
RewriteEngine on6. Add the rewrite rule and conditions below it,
e.g. RewriteRule ^api\/v([0-9]+)\/((([a-zA-Z]+)|(([a-zA-Z]+)\/([a-zA-Z]+)))+)\/?$ index.php?v=$1&api=$2 [L]