How to redirect language prefix to language domain (TLD) I have a single Drupal 7 install running in 2 languages, on 2 domains, but currently using a language prefix as selection. Content can be access as follows:


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


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


  Englishmysite.com/content/wonderfulGermanmysite.de/content/wunderbar


The setup works wonderfully on my dev server, but all the old links with the /de/ language prefix will be broken.

Is there a way to 301 them all with one fell stroke? Or how can I detect and strip the prefix in /de/content and at the same time redirect to .de/content? Is this best accomplished in .htaccess?

For German content, the appropriate redirect pattern would be as follows:


  mysite.com/de/content/wunderbar -> mysite.de/content/wunderbar
  mysite.de/de/content/wunderbar -> mysite.de/content/wunderbar


Since English has no language prefix, how can I subsequently detect English content that is trying to be accessed on the .de domain and redirect accordingly?
I had the same issue and solved it by putting a 301 redirect in the htaccess file:

# 301 rewrite for all prefixed language nodes to their own domain
RewriteRule ^en/(.*)$ http://example.com/$1 [L,R=301]
RewriteRule ^de/(.*)$ http://example.de/$1 [L,R=301]


Then I generated a new sitemap and inserted it in the google webmaster tools. I'll monitor the performance impact of this solution. Update is coming in two weeks!