Rewritemap based on querystring parameters?

ISAPI_Rewrite is Apache mod_rewrite compatible URL rewriter for Microsoft IIS
User avatar
Posts: 92
Joined: 01 Dec 2012, 14:22

Rewritemap based on querystring parameters?

20 Feb 2017, 20:12

I have a section of the rewrite rules that contains a series of rules like so:

Code: Select all
RewriteCond %{QUERY_STRING} ^cat=car.*$ [NC]
RewriteRule mqh/contact-form\.html page.gone?stat=410&typ=cat&cat=Wedding+Car+Hire [NC]

RewriteCond %{QUERY_STRING} ^cat=bal.*$ [NC]
RewriteRule mqh/contact-form\.html page.gone?stat=410&typ=cat&cat=Balloon+Decoration [NC]



Is there a way to create a generic rule with a rewritemap rather than individual rules?

I.e. so that based on the value of "cat" in the querystrng, the querystring in the output URL can have a different value?

User avatar
Posts: 402
Joined: 06 Mar 2012, 11:59

Re: Rewritemap based on querystring parameters?

22 Feb 2017, 10:20

Hello.

Not sure if I cover all your requirements, but consider something like this:

Code: Select all
RewriteEngine On

RewriteMap cat_map txt:cat_map.txt

RewriteCond %{QUERY_STRING} (?:^|&)cat=([^&]+) [NC]
RewriteRule mqh/contact-form\.html$ page.gone\?stat=410&typ=cat&cat=${cat_map:%1} [NC]


And put in cat_map.txt file something like this:

Code: Select all
car   Wedding+Car+Hire
bal   Balloon+Decoration

User avatar
Posts: 2
Joined: 04 Nov 2017, 03:07
Location: New York

Re: Rewritemap based on querystring parameters?

04 Nov 2017, 03:14

The writer has made a magnificent Post of 6 Dollar Essay. It takes after this the entirety considered saw validation that you cannot fight with the truth of the matter isn't always wide, the entirety has its amazing case. A dedication of appreciation is all collectively for this facts.

Click here, For more at 6 Dollar Essay | https://www.6dollaressay.com


Image

Return to ISAPI_Rewrite 3.0

Who is online

Users browsing this forum: No registered users and 13 guests