繁体   English   中英

使用IIS的URL重写模块将下划线替换为破折号

[英]replace underscore with dash using url rewrite module of iis

我有关于网址重写模块的问题。

我想对我的网站实施永久重定向(301)。 和网址是,我想永久重定向

http://demo.datadiary.com/search/product/ahmedab​​ad/ac_dealers

网址至

http://demo.datadiary.com/search/product/ahmedab​​ad/ac-dealers

提前致谢。

我找到了解决方案。 将以下内容放入您的web.config中,但请记住,主机必须在iis中安装了Url重写模块。

<rule name="Imported Rule 1-2" stopProcessing="true">
                    <match url="(search/product/ahmedabad.*/[^/]*?)_([^/_]*)$" ignoreCase="false" />
                    <action type="Redirect" url="{R:1}-{R:2}" redirectType="Permanent" />
                </rule>

暂无
暂无

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

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