logo
Apache Lounge
Webmasters

 

About Forum Index Downloads Search Register Log in RSS X


Keep Server Online

If you find the Apache Lounge, the downloads and overall help useful, please express your satisfaction with a donation.

or

Bitcoin

A donation makes a contribution towards the costs, the time and effort that's going in this site and building.

Thank You! Steffen

Your donations will help to keep this site alive and well, and continuing building binaries. Apache Lounge is not sponsored.
Post new topic   Forum Index -> Apache View previous topic :: View next topic
Reply to topic   Topic: using RedirectMatch and regular expressions
Author
Meedel



Joined: 24 Jun 2015
Posts: 3

PostPosted: Wed 24 Jun '15 7:51    Post subject: using RedirectMatch and regular expressions Reply with quote

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: 692

PostPosted: Fri 26 Jun '15 11:36    Post subject: Reply with quote

Already answered at the Apache user list.
Back to top
James Blond
Moderator


Joined: 19 Jan 2006
Posts: 7371
Location: Germany, Next to Hamburg

PostPosted: Fri 26 Jun '15 17:13    Post subject: Reply with quote

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: 692

PostPosted: Fri 26 Jun '15 17:25    Post subject: Reply with quote

http://www.gossamer-threads.com/lists/apache/users/448173
Back to top
Meedel



Joined: 24 Jun 2015
Posts: 3

PostPosted: Mon 29 Jun '15 14:40    Post subject: Reply with quote

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: 7371
Location: Germany, Next to Hamburg

PostPosted: Mon 29 Jun '15 14:58    Post subject: Reply with quote

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

PostPosted: Thu 02 Jul '15 7:52    Post subject: Reply with quote

I got a working config Smile

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


Reply to topic   Topic: using RedirectMatch and regular expressions View previous topic :: View next topic
Post new topic   Forum Index -> Apache