Subdirectories URL Internally Redirect to Query String

Chris Coyier on

The URL in the browser would be:

https://css-tricks.com/index.php/teachers/a/

The actual page rendered by the server would be:

https://css-tricks.com/index.php?search=teachers&sort=a

RewriteEngine on
RewriteRule ^index/([^/]+)/([^/]+).php /page.php?search=$1&sort=$2 [NC]