I am coming from the IIS world to Apache and would appreciate some help on the rewrite rules.
I want this relative path:
/index.php?go=order&id=12345
to be rewritten as:
/go/order/id/12345
Also, if there are more parameters, they should be converted to path format:
/index.php?go=order&id=12345&action=process
becomes
/go/order/id/12345/action/process
How do I achieve this please? Thanks for any input.
Try putting this in your vhost config:
These rules will make it so if you type in a URL like
http://yourdomain.com/index.php?a=b&1=2&z=xin your browser, the browser will get redirected tohttp://yourdomain.com/a/b/1/2/z/x. When the clean looking URL gets requested, the 2nd set of rules internally rewrites it back to/index.php?a=b&1=2&z=x. If you want to put these rules in an htaccess file (in your document root), you need to remove all the leading slashes in theRewriteRule‘s. So^/needs to be^in the last 3 rules.Note that if you simply go to
http://yourdomain.com/index.php, without a query string, nothing gets rewritten.