Rewrite Query - removing characters

ISAPI_Rewrite is a powerful URL manipulation engine based on regular expressions
User avatar
Posts: 2
Joined: 24 Jun 2012, 20:15

Rewrite Query - removing characters

24 Jun 2012, 20:27

I'm using a client's server, with Isapi_Rewrite 2.8 installed and have the following query. I am a complete novice on Rewrite, so apologies for asking possibly daft questions - just trying to get my head around what I can achieve with it!

Is it possible to take an url such as: Filings&b=384005

and create a rule to do these three things:
1. remove 'result.php?'
2. replace spaces with a hyphen
3. hide '&b=' and anything after it

to display as:

Thanks for your help!

User avatar
Posts: 871
Joined: 12 Mar 2012, 09:54

Re: Rewrite Query - removing characters

25 Jun 2012, 07:52

What you say is partially possible, but I'm afraid removing "&b=384005" is not.
What we can try to do this: Filings&b=384005

Please try the following config:

RewriteRule /result\.php\?Product/([^&]+)&b=(\d+) /Product/$1/$2
RewriteRule (\S)(?:\%20|\s)(\S) $1-$2 [I,NS,RP]

RewriteRule (/Product/([^-]+)-(.+) $1\ $2 [I,NS]
RewriteRule /Product/([^/.]+)/(\d+) /result.php?Product/$1&b=$2 [I,L]

User avatar
Posts: 2
Joined: 24 Jun 2012, 20:15

Re: Rewrite Query - removing characters

25 Jun 2012, 14:34

Thank you very much Anton! Works like a charm, and also it's a great help to use it as a working example for further rewrites (I've already had a fiddle and make some other bits work off the back of this).

I am getting some broken images on the resulting page, however I noted that in some other posts here, so I'm sure I'll sort it out.

Thanks again!

User avatar
Posts: 16
Joined: 13 Nov 2012, 00:19

Re: Rewrite Query - removing characters

13 Nov 2012, 00:48

This could work as other characters seem like distorted or something, but anyway, you might want to share whenever you been able to sort it out.

Return to ISAPI_Rewrite 2.x

Who is online

Users browsing this forum: No registered users and 2 guests