【问题标题】:How to replace + to hyphens from the URL via htaccess rule如何通过 htaccess 规则将 URL 中的 + 替换为连字符
【发布时间】:2014-02-21 02:22:40
【问题描述】:

通过 .htaccess 规则将 URL 中的 + 号替换为连字符

网址是

http://domain.com/sitename/Chandigarh/Indian+Restaurants-in-Sector+28

http://domain.com/sitename/Chandigarh/Indian-Restaurants-in-Sector-28

我想把 + 号改成 - 号。

【问题讨论】:

标签: .htaccess url mod-rewrite hyphen


【解决方案1】:

对此答案的修改应该会有所帮助:

Search and replace in apache htaccess a RewriteRule

RewriteRule ^([^+]*)\+(.*) $1-$2 [N,R=301]

【讨论】:

  • 我使用了那个规则,但是我的+号没有改变。
  • 如果您希望页面重定向,您需要在方括号中添加 R=301。有关更改,请参见上面的代码。
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2020-03-08
  • 1970-01-01
  • 2013-08-27
  • 2012-07-10
  • 1970-01-01
相关资源
最近更新 更多