Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/url/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
.net 用于url重定向的Strip.html_.net_Url_Redirect_Web Config_Url Redirection - Fatal编程技术网

.net 用于url重定向的Strip.html

.net 用于url重定向的Strip.html,.net,url,redirect,web-config,url-redirection,.net,Url,Redirect,Web Config,Url Redirection,我正在做一个重定向从一个旧网站到一个新的网站,使用友好的网址 进入的url是example.com/news-events/some-news-story.html,它会重定向到anotherdomain.com/news/some-news-story 到目前为止,我建立的规则除了从末尾删除.html之外,其他的都可以执行,因此它可以重定向到anotherdomain.com/news/some-news-story.html 这应该很简单,但我画了一个空白 规则如下: <rules&g

我正在做一个重定向从一个旧网站到一个新的网站,使用友好的网址

进入的url是example.com/news-events/some-news-story.html,它会重定向到anotherdomain.com/news/some-news-story

到目前为止,我建立的规则除了从末尾删除.html之外,其他的都可以执行,因此它可以重定向到anotherdomain.com/news/some-news-story.html

这应该很简单,但我画了一个空白

规则如下:

<rules>
    <rule name="Redirect news posts" stopProcessing="true">
      <match url="^news-events/(.*)$" ignoreCase="false" />
      <action type="Redirect" redirectType="Permanent" url="http://www.anotherdomain.com/news/{R:1}" />
    </rule>
  </rules>

感谢您的帮助/建议。

也通过在URL上运行此规则来解决此问题

<rule name="removeextension" enabled="true">
      <match url=".*" negate="false" />
      <conditions>
        <add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
        <add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />
        <add input="{URL}" pattern="\." negate="true" />
      </conditions>
      <action type="Rewrite" url="{R:0}.html" />
    </rule>
从哪来的