试图使用.htaccess规则重定向到加载FR内容W/FR域和EN内容W/EN域

问题描述:

我使用MediaWiki与多语言子页面。试图使用.htaccess规则重定向到加载FR内容W/FR域和EN内容W/EN域

当我去“english.com/Page_title”我想这一点(这是默认值)

当我去“french.com/Page_title”我要加载/ FR子页面加载,这是 “french.com/Page_title/fr”

,这里是我目前的规则:

RewriteBase/

RewriteRule ^[^:]*\.(php|src|jpg|jpeg|png|gif|css|js|inc|swf|flv|phtml|pl|ico|html|shtml|zip|rar|svg|eot|ttf|woff)$ - [L,NC] 
RewriteRule ^index.php?title - [L] 
RewriteRule ^(.*)\&(.*)$ /wiki/index.php?title=$1\%26$2 [L,QSA] 
RewriteCond %{REQUEST_URI} (//+) 
RewriteRule ^(.*)/(.*)$ /wiki/index.php?title=$1%1$2 [L,QSA] 
RewriteRule ^(.+)$ /wiki/index.php?title=$1 [L,QSA] 
RewriteRule ^/*$ /wiki/index.php?title=Main_Page [L,QSA] 

从这里摘自:http://www.mediawiki.org/wiki/Manual:Short_URL/Page_title_--_PHP_as_a_CGI_module,_no_root_access#Alternate_option_V

我已经玩弄各种Rewrit eCond和规则,但无法让它工作,总是无休止的重定向或500's。

+0

您是如何设置MediaWiki以确定从请求中使用哪种语言的?它是查看原始请求路径,还是从查询字符串中获取信息? – 2010-08-24 20:52:33

# 
# Media Wiki 
# 
RewriteBase/
RewriteRule  ^[^:]*\.(php|src|jpg|jpeg|png|gif|css|js|inc|swf|flv|phtml|pl|ico|html|shtml|zip|rar|svg|eot|ttf|woff)$ - [L,NC] 
RewriteRule ^index.php?title - [L] 
RewriteCond %{HTTP_HOST} ^french\.com 
RewriteCond %{REQUEST_URI} !/fr$ 
RewriteRule^%{REQUEST_URI}/fr [L,QSA] 
RewriteRule ^(.*)\&(.*)$ /wiki/index.php?title=$1\%26$2 [L,QSA] 
RewriteCond %{REQUEST_URI} (//+) 
RewriteRule ^(.*)/(.*)$ /wiki/index.php?title=$1%1$2 [L,QSA] 
RewriteRule ^(.+)$ /wiki/index.php?title=$1 [L,QSA] 
RewriteRule ^/*$ /wiki/index.php?title=Main_Page [L,QSA] 

修正了它。