Link to home
Start Free TrialLog in
Avatar of Wayne Barron
Wayne BarronFlag for United States of America

asked on

IIS 10 - URL Rewrite Rule for Search Query, not working?

Hello, All.
(The development is done in ASP Classic (VB), in case I need to do something within the code.)

In the website, our search string is displayed as such.
Main.asp?Type=Results&Submit=Search&Term=KISS&Cat=3

Our URL Rewrite is this.

Pattern: Search/([_0-9a-z-(-)-,-]+)/([_0-9a-z-(-)-,-]+)
Rewrite URL: Main.asp?Type=Results&Submit=Search&Term={R:1}&Cat={R:2}

Screenshot of the RULE
User generated image
How can I make the Search Query work, so that when you click search, it rewrites the URL to this?

Search/KISS/3

Thanks.
Wayne
Avatar of Ryan Chong
Ryan Chong
Flag of Singapore image

your URL Rewrite rule worked well for me.

what's the exact issue you're facing right now?

so that when you click search, it rewrites the URL to this?

if you mean to change form posting action URL based on user's inputs?
Avatar of Wayne Barron

ASKER

When I click search, the URL does not get re-written.
It stays with the same URL


Main.asp?Type=Results&Submit=Search&Term=KISS&Cat=3



Here is the search box.


<form action="//192.168.2.12/Main.asp">
<input type="hidden" name="Type" value="Results">
<table style="text-align:left; vertical-align:top;">
<tbody><tr>
  <td style="border:1px #000000 dotted; font-size:12px;">Search<br />
  <input type="submit" name="Submit" value="Search" tabindex="3">
<input name="Term" type="text" tabindex="1" width="200" value="KISS" onBlur="javascript:if (this.value == '') this.value = 'Search';" onFocus="javascript:if (this.value == 'Search') this.value='';">
<br />
<select class="FormUnits" name="Cat" tabindex="2">
<option value="3">Artist</option>
</select>
</td></tr>
</tbody></table>
</form>

When I click search, the URL does not get re-written.
It stays with the same URL


    Main.asp?Type=Results&Submit=Search&Term=KISS&Cat=3

I think you need to edit the HTML instead. Can you share us the source code of your form's action? or click event ?

Well, I do not like how the new CODE block works on EE.
It messed everything up, which is the reason for posting the code the way I just had to do.

ASKER CERTIFIED SOLUTION
Avatar of Ryan Chong
Ryan Chong
Flag of Singapore 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

As always, Ryan you are the best, my friend.
Have a-Rockin' week.

Wayne

Cool, glad it worked = )

Worked great, just had to add in a replace in it, and works like a champ.
(See below) 

.replace(/ /g,"_")

Open in new window


Have to remove the spaces from between the words typed in.
Love it, works great!!!