IIS 7 and Above
Configuration & Scripting
Need to redirect files in one sub-directory to a different sub-direct...
Last post Jul 22, 2019 09:59 AM by Able
Jul 19, 2019 08:21 AM|Steve.S|LINK
I recently consolidated several domains to one, and have in place 301 redirects from the 2 that are no longer used to the other. However seems I didn't account for a number of specific files in sub-directories, which I realized today are giving 404s. I came
across this web config code from Ross Hawkins, below, but am unsure how to apply it, what folder it should be in, or if it solves my problem.
There are 2 scenarios. In one, the files are in a sub-directory of the main website and i want to redirect them to a specific sub-directory, and in the other, they are in a sub-directory of one of the domains that are no longer used (but still on my server)
and i want to redirect them to specific files in a sub-directory on the main website.
I've Googled this quite a bit, and found web config code but not sure if what I've seen will do what I want. From Ross Hawkins:
<rule name="toservices" stopProcessing="true">
<match url="^(analysis-design|custom-development|webhosting|websites|video).*" ignoreCase="true"/>
<action type="Redirect" url="/services/" redirectType="Permanent" appendQueryString="true" />
thanks for any help!
Jul 19, 2019 03:21 PM|Chris Becke|LINK
Jul 19, 2019 05:08 PM|Steve.S|LINK
Thank you, Chris, but this seems a fairly simple scenario that a rule, something similar to the one I posted, should be able to handle.
Jul 22, 2019 09:59 AM|Able|LINK
According to your description,do you want to redirect the url in the same sub-directory? So does it have index.html in the target sub-directory?It will redirect the index.html by default.