简体   繁体   English

将2个链接以外的所有链接重定向到新URL

[英]Redirect all but 2 links to new URL

I have domain.de and domain.com . 我有domain.dedomain.com In the past I have used both domains, but now I want to use only the domain.de and domain.com should redirect to domain.de/en . 过去我曾经使用过两个域,但是现在我只想使用domain.de和domain.com应该重定向到domain.de/en But there are 2 links which need to be domain.de/api/xx1 + domain.de/api/xx2 (so without the /en). 但是有两个链接需要为domain.de/api/xx1 + domain.de/api/xx2 (因此不带/ en)。 I tried the following: 我尝试了以下方法:

<If "%{HTTP_HOST} = 'domain.com'">
  Redirect /api/xx1 http://domain.de/api/xx1
  Redirect /api/xx2 http://domain.de/api/xx2
  Redirect / http://www.domain.de/en
</If>

But it only redirects everything to .de/en and ignores the two links, how would I change it so that it works? 但是它将仅将所有内容重定向到.de/en并忽略了两个链接,我将如何对其进行更改以使其起作用?

RedirectMatch的用法类似于:

RedirectMatch 301 "^/((?!api).*)" http://www.domain.de/en/$1

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

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