Turns on HTTP redirect for all or part of a website.
Set-IisHttpRedirect [-SiteName] <String> [[-VirtualPath] <String>] [-Destination] <String> [[-HttpResponseStatus] {Permanent | Found | Temporary}] [-ExactDestination] [-ChildOnly] [-WhatIf] [-Confirm] [<CommonParameters>]
Configures all or part of a website to redirect all requests to another website/URL. By default, it operates on a specific website. To configure a directory under a website, set VirtualPath to the virtual path of that directory.
Beginning with Carbon 2.0.1, this function is available only if IIS is installed.
| Name | Type | Description | Required? | Pipeline Input | Default Value |
|---|---|---|---|---|---|
| SiteName | String | The site where the redirection should be setup. |
true | false | |
| VirtualPath | String | The optional path where redirection should be setup. |
false | false | |
| Destination | String | The destination to redirect to. |
true | false | |
| HttpResponseStatus | HttpResponseStatus | The HTTP status code to use. Default is |
false | false | Found |
| ExactDestination | SwitchParameter | Redirect all requests to exact destination (instead of relative to destination). I have no idea what this means. Maybe TechNet can help. |
false | false | False |
| ChildOnly | SwitchParameter | Only redirect requests to content in site and/or path, but nothing below it. I have no idea what this means. Maybe TechNet can help. |
false | false | False |
| WhatIf | SwitchParameter | false | false | ||
| Confirm | SwitchParameter | false | false | ||
| CommonParameters | This cmdlet supports common parameters. For more information type Get-Help about_CommonParameters. |
Set-IisHttpRedirect -SiteName Peanuts -Destination 'http://new.peanuts.com'
Redirects all requests to the Peanuts website to http://new.peanuts.com.
Set-IisHttpRedirect -SiteName Peanuts -VirtualPath Snoopy/DogHouse -Destination 'http://new.peanuts.com'
Redirects all requests to the /Snoopy/DogHouse path on the Peanuts website to http://new.peanuts.com.
Set-IisHttpRedirect -SiteName Peanuts -Destination 'http://new.peanuts.com' -StatusCode 'Temporary'
Redirects all requests to the Peanuts website to http://new.peanuts.com with a temporary HTTP status code. You can also specify Found (HTTP 302), or Permanent (HTTP 301).