简体   繁体   中英

How to redirect in IIS7 for this url format

I wonder how to do specific redirection based on the scenario below?

When people open this url at browser http://www.test.com/gotogoogle it will redirect them to http://www.google.com .

You could use a RewriteMap in the IIS7 URL Rewrite module to achieve this..

http://learn.iis.net/page.aspx/469/using-rewrite-maps-in-url-rewrite-module/

You can achieve this with URL Rewrite module. The rule will be (content of web.config from website root folder):

<?xml version="1.0" encoding="UTF-8"?>
<configuration>
    <system.webServer>
        <rewrite>
            <rules>
                <rule name="Go To Google" stopProcessing="true">
                    <match url="^gotogoogle$" />
                    <action type="Redirect" url="http://www.google.com/" />
                </rule>
            </rules>
        </rewrite>
    </system.webServer>
</configuration>

If you already have web,config, then add appropriate fragment only.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM