maryam mohammadi
maryam mohammadi

Reputation: 694

301 redirect on IIS?

i have tow websites e.g "testsite.ir" and "testsite.com". as i know my web site is on Windows Server 2008, Microsoft-IIS/7.5 . how can i use 301 redirect to redirect users from .ir to .com? can i use .htaccess file or i should use webconfig?

i use the code bellow in my webconfig, but nothing happen:

  <rule name="Redirect from ir to com" stopProcessing="true">
    <match url=".*" />
    <conditions>
    <add input="{HTTP_HOST}" pattern="^www\.testsite\.ir$" />
    </conditions>
    <action type="Redirect" url="http://www.testsite.com/{R:0}" />
    </rule>

Any help would be appreciated!

Upvotes: 1

Views: 281

Answers (1)

levelnis
levelnis

Reputation: 7705

If you have remote access to the server you can do this within IIS. You need to enable HTTP Redirect within IIS (add/remove windows features) before you can add a rule. Once you've enabled it you can redirect the .ir site to the .com site. See here: http://www.iis.net/configreference/system.webserver/httpredirect

Upvotes: 1

Related Questions