So far I have learnt RewriteRule ^([^/]*)/$ index.php?page=$1
Problem 1: How do I parse the url parameters as they are after a point certain point?
E.g. I want this page http://example.com/index.php?page=X&id=2&err=10
to appear as http://example.com/X/?id=2&err=10
. Given that the parameters id
or err
necessarily do not exists. They may or may not be present with others.
Problem 2: For some specific pages suppose page=A
or page=B
, if id
exists, there will be a third parameter as well.
E.g. I want this page http://example.com/index.php?page=A&id=10&name=Abe
to appear as http://example.com/A/Abe/10/
and http://example.com/index.php?page=A&id=10&name=Abe&err=101
to appear as http://example.com/A/Abe/10/?err=101
Edit 30 Jan, 16
Ok. After much searching I found that it could be implemented by using {QUERY_STRING}
. But when I place RewriteRule ^([^/]*)$ index.php?page=$1&%{QUERY_STRING} [NC,L]
in my htaccess my Ajax goes haywire. I want this working to implement only for index.php and no other pages.