Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Redirect additional domains to main .com domain using IIS7 URL Rewrite Module

How should I configure the URL Rewrite Rule in IIS7 to redirect my aditional domains ( domain.net, domain.org, domain.info) to the principal .com domain?

like image 755
holiveira Avatar asked Dec 21 '25 08:12

holiveira


1 Answers

In IIS7, you can use the new command “appcmd.exe” to enable redirection as following:

%windir%\system32\inetsrv\appcmd set config "Default Web Site/" -section:system.webServer/httpRedirect -enabled:true -destination:"http://domain.com"

This tells IIS to redirect all request sending to the virtual application “/” to “http://domain.com”. The actual result is that appcmd.exe adds the following section to the web.config file for “/”:

web.config of your domain.net

<system.webServer>

    <httpRedirect enabled="true" destination="http://domain.com" httpResponseStatus="Permanent"/>

</system.webServer>
like image 90
simplyharsh Avatar answered Dec 23 '25 00:12

simplyharsh



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!