What I am attempting to do, is have pretty URLs. I have achieved this for the case where I want the entire string to point to one PHP script. I do not.
So, this works: example.com/login/1/2
=> /index.php?go=login&do=1&msg=2
Using:
RewriteEngine on
RewriteBase /
RewriteRule ^([0-9a-zA-Z_-]+)/?$ /index.php?go=$1 [L,QSA]
RewriteRule ^([0-9a-zA-Z_-]+)/([0-9a-zA-Z_-]+)/?$ /index.php?go=$1&do=$2 [L,QSA]
RewriteRule ^([0-9a-zA-Z_-]+)/([0-9a-zA-Z_-]+)/([0-9a-zA-Z_-]+)/?$ /index.php?go=$1&do=$2&q1=$3 [L,QSA]
Now let's say I want example.com/webapp/1/2/3
=> webapp.php?1=1&2=2&3=3
By adding this below the above:
RewriteRule ^webapp/?$ /webapp.php [L,QSA]
RewriteRule ^webapp/([0-9a-zA-Z_-]+)/?$ /webapp.php?go=$1 [L,QSA]
RewriteRule ^webapp/([0-9a-zA-Z_-]+)/([0-9a-zA-Z_-]+)/?$ /webapp.php?go=$1&do=$2 [L,QSA]
RewriteRule ^webapp/([0-9a-zA-Z_-]+)/([0-9a-zA-Z_-]+)/([0-9a-zA-Z_-]+)/?$ /webapp.php?go=$1&do=$2&q1=$3 [L,QSA]
Navigating to example.com/webapp
redirects to index.php
every time, stripping any query string.
If I comment out the first code block, and navigate to example.com/webapp
I get webapp.php
as I should.
I get no errors in any log. The access log during the call reports 302 to webapp
What am I doing wrong?