2016-09-16 110 views
0

我试图得到一个基本的URL重写我的Azure的web应用程序Azure的Web应用程序的URL重写不工作

工作
<system.webServer> 
    <rewrite> 
     <rules> 
      <rule name="SalesCloudGmail" stopProcessing="true"> 
       <match url="/SalesCloudGmail.aspx" /> 
       <action type="Redirect" url="/SalesCloudGmail" /> 
      </rule> 
     </rules> 
    </rewrite> 
</system.webServer> 

期待打开URL .../SalesCloudGmail.aspx看看。地址栏中的../SalesCloudGmail ???

我缺少什么

回答

0

试试这个,你的正则表达式匹配是基于你如何使用它的一点点。但这应该起作用,或者至少让你更接近。

<rule name="SalesCloudGmail" stopProcessing="true"> 
    <match url="(.*)" /> 
     <conditions logicalGrouping="MatchAll" trackAllCaptures="false"> 
      <add input="{REQUEST_URI}" pattern="^\/SalesCloudGmail\.aspx.*" /> 
     </conditions> 
     <action type="Redirect" url="https://{HTTP_HOST}/SalesCloudGmail" /> 
</rule> 
+0

感谢 - 重写了URL ...现在它找不到资源(错误=您正在查找的资源已被删除,名称已更改或暂时不可用。)我一定误解了这个功能 - 认为它仍然会显示带有修改过的地址url的页面? – PNC

+0

如果您只想重写URL而不是“重定向”,则需要将操作类型更改为“重写” – Henry

0

请尝试重写规则如下:

<rewrite> 
     <rules> 
     <rule name="SalesCloudGmail" stopProcessing="true"> 
     <match url="^\/SalesCloudGmail\.aspx$" /> 
      <action type="Redirect" url="/SalesCloudGmail" /> 
     </rule> 
     </rules> 
    </rewrite> 

请以下this article来测试你的匹配模式。

+0

谢谢@Jambor - 同样的问题。当我打开它时URL不变。 http://cloudtrio.com/SalesCloudGmail.aspx – PNC