Q:

How to detect/redirect URL with language prefix

I currently have a single website running in 2 languages, on 2 domains, but using a language prefix in the URLs to define German content. Both languages can be accessed on both domains as follows:

English content 
  mysite.com/content/wonderful  
  mysite.de/content/wonderful
German content mysite.com/de/content/wunderbar  mysite.de/de/content/wunderbar

I will change to domain language selection, so that one language is accessible on one domain:

English  mysite.com/content/wonderful
German  mysite.de/content/wunderbar

The problem: We have a lot of content that has been bookmarked and URLs which have been published in print. 75% of our content's links will be changed, meaning many a 404.
Is there a wildcard 301 for sending all .com/de/content and .de/de/content to .de/content?

A:

You can use this rule in your root .htaccess of .com and .de sites:
RewriteEngine On

RewriteRule ^de/(.*)$ http://mysite.de/content/$1 [L,NC,R=301]

