We help IT Professionals succeed at work.

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

Ben Conner
Ben Conner asked
on
20 Views
Last Modified: 2020-05-13
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
Comment
Watch Question

Director, Information Systems
CERTIFIED EXPERT
Commented:
This one is on us!
(Get your first solution completely free - no credit card required)
UNLOCK SOLUTION
Ben ConnerCTO, SAS developer

Author

Commented:
The condition worked but how I framed the result to return seemed to have issues.  
I just need to get more knowledgeable about this functionality.  Came across Scott Forsyth's Youtube videos and he seems to do a good job of explaining it.  Will view a few of those and circle back if I have questions.

Thanks much!

--Ben
Unlock the solution to this question.
Join our community and discover your potential

Experts Exchange is the only place where you can interact directly with leading experts in the technology field. Become a member today and access the collective knowledge of thousands of technology experts.

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

OR

Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.