Want to improve this quest开发者_如何学Goion? Update the question so it's on-topic for Stack Overflow.
Closed 11 years ago.
Improve this questionWe have a webserver running Windows Server 2008 and IIS7 that has had updates upon updates for years on it. Some sub-folders and files have http redirects to other URLs, created with the HTTP Redirect module, some of which are no longer needed but never cleaned out. We are migrating to another server and will want to clean up the http redirects that have been used.
We need a way to find out what folders and pages are setup with redirects and where they are redirecting to. I tried searching the applicationHost.config
file in C:\Windows\System32\inetsrv\config
but that doesn't seem to store them.
Am I looking in the right place? Is there a file I can open and manually look through it to find these redirects? Is there a script (C#, VBS, other) I can run to determine these redirects? Or is there some other method to find these?
Thanks in advance.
UPDATE 1:
Ok, so I did a test and found the the HTTP Redirect module adds a web.config
file in the folder that was selected to be redirected. The web.config
file contained the following code
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.webServer>
<httpRedirect enabled="true" destination="http://www.mysite.com" exactDestination="true" />
</system.webServer>
</configuration>
I guess I'll have to right a script to iterate through each folder and read the web.config
files and see if the httpRedirect
line exists. If someone has the code readily available or would like to through something up it would be nice and I'd give ya the points for the answer. If possible, have it be a code I can add to a page on the root website and will just print out the destination
in the web.confg
file and the path path of that web.config
file.
Thanks!
You can quite easily do this using GUI tool:
- Launch IIS Manager
- Connect to a server
- On the server root find Configuration Editor (if modules are grouped by "Area" it should be under Management, if by "Category" then under Server Components).
- On right side panel click on Search Configuration. This will display dialog window with ALL known to IIS configuration files.
- Type section name in search box on top and only files with that section present will be shown
- If you click on the section in left side, its content will be displayed on right side.
- On the bottom of right side there will be a link to the actual file. If you click on it it will open that web.config (or whatever that file will be) in associated program.
This will not give you the list of "what redirects where" (I do not think there is anything like that available at all), but you will see all the rules, so you can gather them together and investigate what they do.
Have you checked to see if the URL Rewrite Module is installed? If it is, it'll show up under the web server/site configuration.
精彩评论