Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

IIS Redirection - command line

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

like image 477
clklachu Avatar asked May 08 '26 02:05

clklachu


1 Answers

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"}
like image 151
Pauli Østerø Avatar answered May 11 '26 06:05

Pauli Østerø