Apache mod rewrite examples
Scenario 1: To extract the specific word from QUERY_STRING in a URL. RewriteCond %{QUERY_STRING} ^(.*)matching-word=([^&]+)&?(.*)$ RewriteRule ^(.*)request-url$ https://%{HTTP_HOST}/some/path/value=%2 [NE,QSA,PT,L] In the above scenario, we would like to extract the value after <matching-word> string and before the & or ? charecters in the QUERY_STRING. Example: Source url: https://mydomain.com/request/url/test1?myquery&string= value1 &test123 Destination url: https://mydomain.com/some/path/value= value1