How to remove index.php and index from the URL using htaccess | PHP



PHP Snippet 1:

example.com/qa/index.php?id=506&slug=how-to-connect-the-html-page-to-the-mysql-database-using-php

PHP Snippet 2:

example/qa/index/506/how-to-connect-the-html-page-to-the-mysql-database-using-php

PHP Snippet 3:

RewriteEngine on
RewriteRule ^([0-9]+)/([0-9a-zA-Z_-]+)$ index.php?id=$1&slug=$2 [NC,L]

PHP Snippet 4:

example/qa/506/how-to-connect-the-html-page-to-the-mysql-database-using-php 

PHP Snippet 5:

example.com/qa/login.php 

PHP Snippet 6:

 RewriteEngine On
    RewriteRule ^login\/?$ login.php

PHP Snippet 7:

example.com/qa/login