Avatar of Ben Conner
Ben Conner
Flag for United States of America

asked on 

URL Rewrite--redirecting to main URL when a specific folder gets entered

Hi,

I'm trying to use IIS' URL Rewrite to map any entry for a domain with /menus back to the original domain.
Example:

www.example.com/menus  -->  www.example.com
www.example.com/menus/ --> www.example.com
www.example.com/menus/index.htm --> www.example.com

and the same when the www. is omitted.

I've been trying variants on:

        <rewrite>
            <rules>
                <rule name="Remove_Menus" stopProcessing="true">
                    <match url="^(.*)(menus)$" />
                    <action type="Redirect" url="http://example.com" />
                </rule>
            </rules>
        </rewrite>

Am getting tripped up by this though.  What I want is if anyone enters .../menu or something below menu, it will redirect to the main url.  ??

Thanks!

--Ben
Microsoft IIS Web Server

Avatar of undefined
Last Comment
Ben Conner

8/22/2022 - Mon