| Author |  | 
| Meedel 
 
 
 Joined: 24 Jun 2015
 Posts: 3
 
 
 | 
|  Posted: Wed 24 Jun '15 7:51    Post subject: using RedirectMatch and regular expressions |   |  
| 
 |  
| Hello, 
 I'm using apache webserver for implementing virtual hosts.
 I want support on using RedirectMatch in combination with regular expressions.
 I want to redirect an incoming url with specific information to redirect to a local file.
 I'm trying the next line:
 
 RedirectMatch /sap/opu/odata/sap/ZVPOSTREAD_SRV/AktepostSet(.*(\bBSL01\b).*)	http://10.103.140.62/BSL01_X_1197.json                     ( This gives no match !? )
 
 The incoming url looks like:
 http://10.103.140.62:80/sap/opu/odata/sap/ZVPOSTREAD_SRV/AktepostSet?$filter=Gemeentecode%20eq%20%27BSL01%27%20and%20Sectie%20e
 q%20%27X%27%20and%20Perceelsnummer%20eq%20%2701197%27&$format=json
 and I want to check on the word BSL01
 
 With kind regards,
 |  | 
| Back to top |  | 
| admin Site Admin
 
  
 Joined: 15 Oct 2005
 Posts: 706
 
 
 | 
|  Posted: Fri 26 Jun '15 11:36    Post subject: |   |  
| 
 |  
| Already answered at the Apache user list. |  | 
| Back to top |  | 
| James Blond Moderator
 
  
 Joined: 19 Jan 2006
 Posts: 7442
 Location: EU, Germany, Next to Hamburg
 
 | 
|  Posted: Fri 26 Jun '15 17:13    Post subject: |   |  
| 
 |  
| Dear Admin, will you let us know the answer or post the link to it? |  | 
| Back to top |  | 
| admin Site Admin
 
  
 Joined: 15 Oct 2005
 Posts: 706
 
 
 |  | 
| Back to top |  | 
| Meedel 
 
 
 Joined: 24 Jun 2015
 Posts: 3
 
 
 | 
|  Posted: Mon 29 Jun '15 14:40    Post subject: |   |  
| 
 |  
|  	  | admin wrote: |  	  | http://www.gossamer-threads.com/lists/apache/users/448173 | 
 
 I tried the given info but I don't get the right result.
 
 My documentroot is D:\data\ApacheWebserver\input
 and with this rewrite config it is trying to search for: %documentroot%\sap\opu\odata\sap\ZVPOSTREAD_SRV\AktepostSet.
 
 It's looking for an index.html in the 'new' documentroot dir.
 The statements are completely ignored!?
 RewriteCond %{QUERY_STRING} ^.*%27(XXX01)%27.*$
 |  | 
| Back to top |  | 
| James Blond Moderator
 
  
 Joined: 19 Jan 2006
 Posts: 7442
 Location: EU, Germany, Next to Hamburg
 
 | 
|  Posted: Mon 29 Jun '15 14:58    Post subject: |   |  
| 
 |  
| Is the regedx ok? Check it at the 
  	  | Code: |  	  | http://regexper.com/#^.*%2527%28XXX01%29%2527.*%24 | 
 |  | 
| Back to top |  | 
| Meedel 
 
 
 Joined: 24 Jun 2015
 Posts: 3
 
 
 | 
|  Posted: Thu 02 Jul '15 7:52    Post subject: |   |  
| 
 |  
| I got a working config   
 RewriteEngine on
 RewriteCond "%{QUERY_STRING}" "AMR03"
 RewriteRule ^/sap/opu/odata/sap/ZVPOSTREAD_SRV/AktepostSet(.*)	D:/\data/\ApacheWebserver/\input/\AMR03_H_4151.json [L]
 RewriteCond "%{QUERY_STRING}" "BSL01"
 RewriteRule ^/sap/opu/odata/sap/ZVPOSTREAD_SRV/AktepostSet(.*)	D:/\data/\ApacheWebserver/\input/\BSL01_X_1197.json [L]
 RewriteRule .* - [F]
 |  | 
| Back to top |  |