Forum Moderators: open

Message Too Old, No Replies

Rewrite (ISAPI) dilema.

         

bmouthrob

12:32 pm on Jun 7, 2006 (gmt 0)

10+ Year Member



Hi all,
I'm a newbie here, so be nice ;oP

Just a quick question about ISAPI rewrite, I just tried to reply to an older post after searching but the forum said it was too old.. Anyhow...

I basically want to do the following, but as I've never touched any sort of rewrites at all am a bit stuck!

For example if we had a URL of:
www.example.com/product.asp?PID=123

I would like the URL using ISAPI rewite to be something like:
www.example.com/PRODUCT TYPE/BRAND/SERIAL NUMBER/123.htm

The thing I can't figure out is how to get the rewrite to ignore the "/PRODUCT TYPE/BRAND/SERIAL NUMBER" bit and then construct the URL from whats left... If anyone could help I'd be eternally grateful. I realise this may not be the best forum to post in, but it didn't seem relevant to any others.

Thanks guys / gals!

Rob.

mrMister

12:33 am on Jun 9, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



RewriteRule ^/.*/(\d)+.htm$ /product.asp?PID=$1

bmouthrob

9:42 am on Jun 9, 2006 (gmt 0)

10+ Year Member



Thanks for replying!

Is there any chance i could ask at all just what does what in that statement at all?

Thanks again.
Rob.

mrMister

11:25 am on Jun 9, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Oops,I got it wrong, it should be:

RewriteRule ^/.*/(\d+).htm$ /product.asp?PID=$1 

>Is there any chance i could ask at all just what does what in that statement at all?

^ = match the start of a string

.* = match 0 or more characters

() = capture data

\d = capture any sequence of one or more decimal characters

$ = match the end of the string

$1 = output the first capture, i.e the contents of (\d+)

[regexlib.com...]