replace underscore with dash using url rewrite mod

2019-08-04 08:41发布

I have issue regarding Url rewrite module.

I want to implement permanent redirect (301) into my site. and url is, I want to permanently redirect

http://demo.datadiary.com/search/product/ahmedabad/ac_dealers

url to

http://demo.datadiary.com/search/product/ahmedabad/ac-dealers

Thanks in advance.

1条回答
男人必须洒脱
2楼-- · 2019-08-04 09:04

I got the solution. put the following into your web.config, but keep in mind that your host must have installed Url rewrite module in iis.

<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>
查看更多
登录 后发表回答