Forum Moderators: phranque
http://www.domain.com/?mod=test&act=view http://www.domain.com/view-test http://www.domain.com/view-test viewing the content of the first uri. RewriteRule ^view-test$ /?mod=test&act=view [NC]
RewriteCond %{QUERY_STRING} mod=test&act=view
RewriteRule ^(.*)$ /view-test? [R,L] # REDIRECT
RewriteCond %{THE_REQUEST} [A-Z]{3,9}\ /<pattern1>\ HTTP/
RewriteRule ^<pattern2> http://www.example.com/<somepath> [R=301,L] # REWRITE
RewriteRule ^<pattern3> /index.php?query=<value> [L]
Changing a Query
#1 To delete a query, add a ? to the end of your rewrite target.
#2 To replace a query—or create a new one—add ?blahblah to the rewrite target. The blahblah can be either literal text, or stuff you captured earlier. (#1 and #2 are really the same thing: you're just replacing the query with either something or nothing.)
#3 To add to an existing query, again put ?blahblah at the end of the target, but also add [QSA] to your flags (the bracketed items at the end of the Rule). It stands for "Query String Append", meaning that the blahblah is to be added to the existing query—if any—instead of replacing it.
http://www.domain.com/view-test?mod=test&act=view&order_by=id