You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by "Meedendorp, Bert" <Be...@kadaster.nl> on 2015/06/24 07:48:20 UTC

[users@httpd] 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%20eq%20%27X%27%20and%20Perceelsnummer%20eq%20%2701197%27&$format=json

and I want to check on the word BSL01





With kind regards,





Bert



Disclaimer:
De inhoud van dit bericht is uitsluitend bestemd voor geadresseerde.
Gebruik van de inhoud van dit bericht door anderen zonder toestemming van het Kadaster
is onrechtmatig. Mocht dit bericht ten onrechte bij u terecht komen, dan verzoeken wij u
dit direct te melden aan de verzender en het bericht te vernietigen.
Aan de inhoud van dit bericht kunnen geen rechten worden ontleend.

Disclaimer:
The content of this message is meant to be received by the addressee only.
Use of the content of this message by anyone other than the addressee without the consent
of the Kadaster is unlawful. If you have received this message, but are not the addressee,
please contact the sender immediately and destroy the message.
No rights can be derived from the content of this message.

Re: [users@httpd] using RedirectMatch and regular expressions

Posted by Yann Ylavic <yl...@gmail.com>.
On Wed, Jun 24, 2015 at 7:48 AM, Meedendorp, Bert
<Be...@kadaster.nl> wrote:
>
> 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%20eq%20%27X%27%20and%20Perceelsnummer%20eq%20%2701197%27&$format=json
>
> and I want to check on the word BSL01

RedirectMatch does not match the query-string, you must use mod_rewrite instead.
Something like:

RewriteEngine on
RewriteCond %{QUERY_STRING} ^.*%27(BSL01)%27.*$
RewriteRule ^/sap/opu/odata/sap/ZVPOSTREAD_SRV/AktepostSet$
http://10.103.140.62/%1_X_1197.json? [R]

(You may also omit the http://<host/IP> and [R] parts to use an
internal redirection instead, since the redirection seems to be on the
same host/IP).

Regards,
Yann.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org