我为我的mediawiki实现短网址,我的htaccess的作品有这些:
I've implemented Short URL for my mediawiki and I have these in htaccess that works:
RewriteRule ^/?wiki(/.*)?$ %{DOCUMENT_ROOT}/w/index.php [L]
RewriteCond %{DOCUMENT_ROOT}%{REQUEST_URI} !-f
RewriteCond %{DOCUMENT_ROOT}%{REQUEST_URI} !-d
RewriteRule ^/?w/images/thumb/[0-9a-f]/[0-9a-f][0-9a-f]/([^/]+)/([0-9]+)px-.*$ %{DOCUMENT_ROOT}/w/thumb.php?f=$1&width=$2 [L,QSA,B]
RewriteCond %{DOCUMENT_ROOT}%{REQUEST_URI} !-f
RewriteCond %{DOCUMENT_ROOT}%{REQUEST_URI} !-d
RewriteRule ^/?w/images/thumb/archive/[0-9a-f]/[0-9a-f][0-9a-f]/([^/]+)/([0-9]+)px-.*$ %{DOCUMENT_ROOT}/w/thumb.php?f=$1&width=$2&archived=1 [L,QSA,B]
我如何重定向页面的URL,这并不具有网页标题Main_Page?像重定向mysite.com/wiki/到mysite.com/w/index.php/Main_Page?在MW阿帕奇重写手册,它说的:
How do I redirect page urls that doesnt have page title to Main_Page? Like redirecting mysite.com/wiki/ to the mysite.com/w/index.php/Main_Page? In the MW Apache rewrite Manual it says this:
另外,您可以包含一个规则,以显示在主画面的道路上 本身,简化导航当人们访问的URL无需页面 指定的标题:
Optionally, you can include a rule to show the Main Page on the path itself, to simplify navigation when people visit urls without a page title specified:
#重定向/主页重写规则^ / * $%{DOCUMENT_ROOT} /w/index.php [L]
当我添加上面,主域名地址被重定向到维基我不希望因为我有一个不同的主页,而不是维基。我只是想重定向,看起来像mysite.com/wiki地址
When I add the above, the main domain address gets redirected to wiki which I dont want since I have a different Home Page and not wiki. I only want to redirect the address that looks like mysite.com/wiki
我想这改写,但它不工作。
I tried this rewrite but it doesnt work.
RewriteRule ^/?wiki/?$ %{DOCUMENT_ROOT}/w/index.php [L]
很显然,我得到了一些错误。有人可以看看这个吗?
Obviously I got something wrong. Can someone look at this please?
此重定向规则应该自动处理重定向的URL中包含/无维基页面标题/维基/ Main_Page过:
This redirect rule should automatically take care of redirecting urls with no page title like /wiki/ to the wiki/Main_Page too:
RewriteRule ^/?wiki(/.*)?$ %{DOCUMENT_ROOT}/w/index.php [L]
它不是因为有在此之前其他重写规则之前,为我工作。它的工作,一旦我提出这个重写规则顶端其他所有重写规则之前。
It wasnt working for me before since there was other rewrite rules before this. It worked once I move this rewrite rule to the top before all other rewrite rules.