我正在将MediaWiki与多个子页面一起使用。
当我去“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]
我玩过各种RewriteCond和规则,但无法让它工作,总是无限重定向或500。
答案 0 :(得分: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]
修正了它。