I have looked at these solutions and none of them actually work properly on my end:
mod_rewrite to remove .php but still serve the .php file?
How to remove file extension from website address?
How to use Apache Mod_rewrite to remove php extension, while preserving the GET parameters?
and they just don't do the following, which is what I need done:
1) remove .php extension from files and instead of /index.php display /index
2) preserve GET parameters (which I read and store in session cookies while the file is being loaded, in the header), so instead of /index.php?a=1&b=2 display maybe /index/a1/b2
3) work on subdomains and https:// without messing up the URL completely or ending up in an infinite loop or something...
Does anyone have a clue how to put together these rules so they cover the 3 points above correctly?
This is what I'm working with as a starting point:
RewriteCond %{THE_REQUEST} (\.php(.*)\sHTTP/1)
RewriteRule ^(.+)\.php$ /$1 [R=301,L,QSA]