2

I just added an new rewrite rule so I can redirect pages like:

www.Domain.com/PartnerNameHere/

to:

www.Domain.com/LandingPage?page=PartnerNameHere

However now all axd references are not working.

How do I set: ignore extensions for css,jpg,png axd..

enter image description here

1 Answer 1

3
+100

Current your match pattern for RewriteUserFriendlyURL1 is ^([^/]+)/?$, which makes no concession for extensions (it's matching any queries with a single URI segment).

If PartnerNameHere can never contain a ., then changing your match pattern to ^([^/.]+)/?$ should be sufficient.

If, however, you only want to block those specific extensions, you'll need to use this: ^(?![^/]+?\.(?:css|png|jpg|axd)$)([^/]+)/?$

Sign up to request clarification or add additional context in comments.

4 Comments

Thanks .. I tried that and got this error: HTTP Error 500.52 - URL Rewrite Module Error. The expression "^([^/]+)/?(?<!\.(?:css|png|jpg|axd))$" has a syntax that is not valid.
@aron - I'm not sure why, but the Rewrite rule doesn't seem to support negative lookbehind assertions. I've updated it to use a negative lookahead assertion that I've tested in IIS. I'll update it again if I can get lookbehinds to work.
I've asked about the neg. lookbehind issue on the IIS forums and I'll update my answer should I get a response - forums.iis.net/p/1175656/1971981.aspx
This is exactly what I also needed, much appreciated.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.