How can I modify the .htaccess file and get SEO friendly URLS instead of a query string. I want to achieve this 3 goals:
You need new set of rules for 2 parameters:
RewriteEngine on
RewriteBase /example/
# external redirect from actual URL to pretty one
RewriteCond %{THE_REQUEST} /products(?:\.php)?\?id=([^\s&]+)&color=([^\s&]+) [NC]
RewriteRule ^ products/%1/%2/? [R=302,L,NE]
RewriteCond %{THE_REQUEST} /products(?:\.php)?\?id=([^\s&]+)\s [NC]
RewriteRule ^ products/%1/? [R=302,L,NE]
RewriteCond %{REQUEST_FILENAME} -d [OR]
RewriteCond %{REQUEST_FILENAME} -f
RewriteRule ^ - [L]
# internal forward from pretty URL to actual one
RewriteRule ^products/([^/]+)/?$ products.php?id=$1 [NC,L,QSA]
RewriteRule ^products/([^/]+)/([^/]+)/?$ products.php?id=$1&color=$2 [NC,L,QSA]
RewriteRule ^products/?$ products-list.php [L,NC]