Link to home
Start Free TrialLog in
Avatar of mackaboogie
mackaboogie

asked on

Need regex for IIS URL rewrite

I have to write a URL re-write using the IIS7 url rewrite tool.

My original URL looks like /events/A-New-Site-OOO.htm?promotion=3036
I need the to be able to create the back references for each part...

$1 = events
$2 = A-New-Site-OOO
$3 = promotion=3036

$2 should be able to handle hyphens
$3 should be everything after the ? or the original query string
Avatar of mackaboogie
mackaboogie

ASKER

Just a starter...
I started with something like this:
^([-A-Za-z0-9]+)/([^/]+)(\.[^.]*$)$

What it gives me is the following..

$1 = events
$2 = A-New-Site-OOO
$3 = .htm?promotion=3036

so I am pretty close...
Avatar of Terry Woods
Try:
^([-A-Za-z0-9]+)/([^/]+)[^/]*\?(.*)$
ASKER CERTIFIED SOLUTION
Avatar of Zvonko
Zvonko
Flag of North Macedonia image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
What if you did:

([^/]+)/([^.]+)[^?]+\?(.*)

Open in new window