Reputation: 492
Is it possible to create a URL rewrite that places the content of a subfolder in the root?
Example:
/pages/article1 would be reached from /article1
/pages/otherstuff would be reached from /otherstuff
I don't want to use virtual directories, because we're talking about hundreds of static pages in the /pages folder.
Upvotes: 1
Views: 850
Reputation: 492
I found the answer myself... This did the trick:
<rule name="RemoveSEOFolder" stopProcessing="true">
<match url="^seo$|^seo/(.*)$" />
<conditions>
</conditions>
<action type="Redirect" url="seo/{R:1}" />
</rule>
<rule name="RewriteToFile">
<match url="^(?!seo/)(.*)" />
<conditions>
<add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
<add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />
</conditions>
<action type="Rewrite" url="seo/{R:1}" />
</rule>
Upvotes: 1