简体   繁体   English

URL重写:我的规则语法是否错误

[英]URL Rewrite: Is my syntax of the rule wrong

Hello i am using a Smartasp which i allowed me to do url rewrite. 您好,我使用的是Smartasp,我允许我进行网址重写。 I placed a rules on web.config like this: 我在web.config上放置了这样的规则:

<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. 我尝试读取请求的URL的地方:www.blah.com/amazon/到amazon.blah.com。 After typing the www.blah.com/amazon/ the browser didn't redirect to amazon page... 输入www.blah.com/amazon/后,浏览器未重定向到亚马逊页面...

On my local machine where i typed the rules has a rewrite tag highlighted saying invalid rewrite under system.webserver. 在我输入规则的本地计算机上,高亮显示了一个重写标签,表明在system.webserver下无效重写。 Am i missing something? 我想念什么吗?

Try it this way with a http : 使用http尝试这种方式:

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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