简体   繁体   中英

Redirect all but 2 links to new URL

I have domain.de and domain.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 . But there are 2 links which need to be domain.de/api/xx1 + domain.de/api/xx2 (so without the /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?

RedirectMatch的用法类似于:

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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