简体   繁体   中英

URL Rewrite: Is my syntax of the rule wrong

Hello i am using a Smartasp which i allowed me to do url rewrite. I placed a rules on web.config like this:

<system.webServer>
        <rewrite>
            <rules>
                <rule name="AmazonS3" stopProcessing="true">
                    <match url="http://www.blah/amazon/(.*)" />
                    <action type="Redirect" url="http://amazon.blah/{R:1}" logRewrittenUrl="true" redirectType="Permanent" />
                </rule>
                <rule name="AmazonS3 with port" stopProcessing="true">
                    <match url="http://www.blah.com:80/amazon/(.*)" />
                    <action type="Redirect" url="http://amazon.blah.com/{R:1}" logRewrittenUrl="true" redirectType="Permanent"/>
                </rule>

Where i try to read the requested url : www.blah.com/amazon/ to amazon.blah.com. After typing the www.blah.com/amazon/ the browser didn't redirect to amazon page...

On my local machine where i typed the rules has a rewrite tag highlighted saying invalid rewrite under system.webserver. Am i missing something?

Try it this way with a http :

<rule name="Page Redirect" stopProcessing="true">
  <match url="www.blah.com/amazon/"/>
  <action type="Redirect" url="http://amazon.blah.com" redirectType="Permanent"/>
</rule>

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