digital1stein
asked on
exclude folders from a rewrite rule in IIS 7
Hi,
I have a site that needs url rewriting. I already managed to get the following working:
* www.atlanta.com/sounddesign --> rewritten as --> www.atlanta.com/?category=sounddesign
* www.atlanta.com/sounddesign/1234 --> rewritten as --> www.atlanta.com/?category=sounddesign&item=1234
My problem is that the website relies on css ans js files that are located in the directories /js en /css on the same webroot, so I need to exclude these in the rules or these links also get rewritten unintentionally.
In short, I need to achieve this:
* www.atlanta.com/js/ --> not rewritten
* www.atlanta.com/css/ --> not rewritten
I've been experimenting with this for quite some time now, but can't get it right.
Attached you'll find my web.config file.
Any help is highly appreciated!
I have a site that needs url rewriting. I already managed to get the following working:
* www.atlanta.com/sounddesign --> rewritten as --> www.atlanta.com/?category=sounddesign
* www.atlanta.com/sounddesign/1234 --> rewritten as --> www.atlanta.com/?category=sounddesign&item=1234
My problem is that the website relies on css ans js files that are located in the directories /js en /css on the same webroot, so I need to exclude these in the rules or these links also get rewritten unintentionally.
In short, I need to achieve this:
* www.atlanta.com/js/ --> not rewritten
* www.atlanta.com/css/ --> not rewritten
I've been experimenting with this for quite some time now, but can't get it right.
Attached you'll find my web.config file.
Any help is highly appreciated!
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.webServer>
<rewrite>
<outboundRules>
<preConditions>
<preCondition name="ResponseIsHtml1">
<add input="{RESPONSE_CONTENT_TYPE}" pattern="^text/html" />
</preCondition>
</preConditions>
</outboundRules>
<rules>
<rule name="RedirectUserFriendlyURL1" enabled="true" stopProcessing="true">
<match url="([_0-9a-z-]+)" />
<conditions>
<add input="{REQUEST_METHOD}" pattern="^POST$" negate="true" />
</conditions>
<action type="Rewrite" url="/?category={R:1}" appendQueryString="true" />
</rule>
</rules>
</rewrite>
</system.webServer>
</configuration>
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Happy you got is all sorted out. -Hades666
ASKER