문제

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?

도움이 되었습니까?

해결책

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]
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top