Reputation: 971
I have a website say www.mywebsite.com/demo . When ever if anyone requests this site, i want to navigate to another website www.myanotherwebsite.com . I know that this can be done in IIS by using the HTTP Redirect feature. But since i want to do this for different websites, I would like to write a bat file which would run the command to set the redirect url for a website. Can anyone please help me how to set the redirection URL through command line?
Edit: I'm using IIS 7
Upvotes: 3
Views: 5150
Reputation: 6916
Look at this PowerShell script
http://forums.iis.net/t/1162778.aspx
Set-WebConfiguration system.webServer/httpRedirect "IIS:\sites\Default Web Site" -Value @{enabled="true";destination="domain.com";exactDestination="true";httpResponseStatus="Permanent"}
Upvotes: 4