Link to home
Start Free TrialLog in
Avatar of mandi224
mandi224Flag for United States of America

asked on

IIS 7 301 Redirect for all contents of a directory

I'm using IIS 7 URL rewriting on our site and want to have a 301 redirect of everything in our /catalog directory.

I added this rule to the web.config at the root of the site:
<rule name="No Catalog">
     <match url="^Catalog*$" />
     <action type="Redirect" redirectType="Permanent" url="/home" />
</rule>

Open in new window


When I go to http://www.mysite.com/catalog, it performs the 301 redirect correctly.

However, if I go to something like http://www.mysite.com/catalog/category/something.aspx, it does not perform the 301 redirect like I want it to.

Is my match URL not correct? How can I get EVERYTHING within /catalog/ to 301 redirect to /home?
ASKER CERTIFIED SOLUTION
Avatar of BuggyCoder
BuggyCoder
Flag of India image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of robdl
robdl

It may be best to do it withing IIS. I use this method regularly.

http://www.iis.net/ConfigReference/system.webServer/httpRedirect