htaccess为多语言Drupal站点的一个域重定向

时间:2022-01-15 15:19:48

I have a multi language Drupal site with default English on www.domain.com and a French site at www.domain.fr and a French Canadian site at fr.domain.ca

我有一个多语言的Drupal站点,在www.domain.com上有默认的英语,在www.domain.fr上有一个法语站点,在fr.domain.ca上有一个法语的加拿大站点。

I have the same URLs on all three sites for similar content, but now I need to redirect www.domain.com/content/a-web-page but not fr.domain.ca/content/a-web-page or www.domain.fr/content/a-web-page If a use the following,

对于类似的内容,我在所有三个站点上都有相同的url,但是现在我需要重定向www.domain.com/content/a-web页面,而不是fr.domain。ca/content/a-web页面或www.domain.fr/content/a-web页面

RewriteRule ^content/a-web-page http://www.domain.com/a-new-web-page [R=301,L]

it redirects every language to the new english page.

它将每种语言都重定向到新的英语页面。

I have researched more complicated patterns but I am really stuck.

我研究过更复杂的模式,但我真的被困住了。

Thanks for any help.

感谢任何帮助。

2 个解决方案

#1


3  

Try to use

尝试使用

RewriteCond %{HTTP_HOST} www.domain.com
RewriteRule ^content/a-web-page http://www.domain.com/a-new-web-page [R=301,L]

You can read more about RewriteCond here: http://httpd.apache.org/docs/2.2/mod/mod_rewrite.html#rewritecond

您可以在这里阅读更多关于RewriteCond的内容:http://httpd.apache.org/docs/2.2/mod/mod_rewrite.html# RewriteCond

#2


0  

You can use:

您可以使用:

RewriteCond %{HTTP_HOST} ^(www\.)?domain\.com$ [NC]
RewriteRule ^content/(.*)$ $1 [R=301,L,NC]

#1


3  

Try to use

尝试使用

RewriteCond %{HTTP_HOST} www.domain.com
RewriteRule ^content/a-web-page http://www.domain.com/a-new-web-page [R=301,L]

You can read more about RewriteCond here: http://httpd.apache.org/docs/2.2/mod/mod_rewrite.html#rewritecond

您可以在这里阅读更多关于RewriteCond的内容:http://httpd.apache.org/docs/2.2/mod/mod_rewrite.html# RewriteCond

#2


0  

You can use:

您可以使用:

RewriteCond %{HTTP_HOST} ^(www\.)?domain\.com$ [NC]
RewriteRule ^content/(.*)$ $1 [R=301,L,NC]