Yaseer
Yaseer

Reputation: 518

URL Rewriting in asp.net mvc umbraco

I need to know when following rule didn't match, It should go to the error page.

For example "sample-code" or "-my-code.html" keyword mismatch It will redirect to error page.

<add name="Results" 
   virtualUrl="^~/(UK|USA)/sample-code/([^/]+)-my-code.html" 
   rewriteUrlParameter="ExcludeFromClientQueryString"    
   destinationUrl="~/my-pages/example.aspx?region=$1&amp;location=$2" 
   redirectMode="Permanent" ignoreCase="true" />

Please let me know find a solution for above problem.

Upvotes: 0

Views: 130

Answers (1)

Tim
Tim

Reputation: 4257

It looks like you're using the built in rewrite module that ships with Umbraco. Unfortunately that doesn't support the functionality you're looking for.

You need to use the IIS Rewrite module instead, as that supports negating rules. You could then create a rule that will catch all URLs, but that is negated by correctly matching the pattern.

Upvotes: 1

Related Questions