0

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?

hjpotter92
  • 78,589
  • 36
  • 144
  • 183
Owlet
  • 49
  • 6
  • Use `RedirectMatch` instead of `Redirect`. – hjpotter92 Sep 30 '15 at 08:02
  • Thanks, but I noticed that it doesn't work like that since the api call cant follow redirects. Now I want to exclude the /api sub-directory from the redirect. So that everything from domain.com except domain.com/api redirects to domain.de/en. How would this work? Thanks!! – Owlet Sep 30 '15 at 08:48

1 Answers1

0

The usage of RedirectMatch would be something like:

RedirectMatch 301 "^/((?!api).*)" http://www.domain.de/en/$1
hjpotter92
  • 78,589
  • 36
  • 144
  • 183
  • Thanks, it still redirects /api though. Do you have any idea how to get everything apart from /api working? Thanks!! – Owlet Oct 01 '15 at 11:05