【问题标题】:RedirectMatch with excluding URLs?不包括 URL 的 RedirectMatch?
【发布时间】:2015-11-20 12:06:03
【问题描述】:

我想做一个RedirectMatch 规则并排除一个url:

RedirectMatch 301 /citycards/citycards-locations/muenchen/((?!trachtenvogl).*) city-news.info/citycards/citycards-locations/muenchen$1

我想排除这个网址:

http://www.city-news.info/citycards/citycards-locations/munchen/citycards-trachtenvogl-reichenbachstr-47-munchen 来自redirectMatch 你能看出一个错误吗?以及如何排除第二个网址?我希望有人可以帮助我

【问题讨论】:

标签: apache .htaccess url-redirection mod-alias


【解决方案1】:

在你的 Root/.htaccess 文件中试试这个

RedirectMatch ^/((?!citycards/citycards-locations/munchen/citycards-trachtenvogl-reichenbachstr-47-munchen).+)$ http://city-news.info/citycards/citycards-locations/muenchen/$1

这将重定向

http://city-news.info/foo/bar

http://city-news.info/citycards/citycards-locations/muenchen/foo/bar

这不会重定向:

http://city-news.info/citycards/citycards-locations/munchen/citycards-trachtenvogl-reichenbachstr-47-munchen

【讨论】:

猜你喜欢
  • 2014-02-06
  • 1970-01-01
  • 2012-05-17
  • 1970-01-01
  • 2014-06-27
  • 2014-09-12
  • 2023-04-10
  • 1970-01-01
  • 2020-06-10
相关资源
最近更新 更多