2010-08-24 32 views
1

我使用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

回答

1
# 
# 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] 

修正了它。

相關問題