mediawiki使用短网址的办法
mediawiki默认的文章地址是index.php?title=,显得比较长,也不美观。区别如下
http://abc.com/index.php?title=文章
http://abc.com/文章
软件版本:mediawiki 1.17
设置两步就可以
1:在LocalSettings.php文件中加入这两行
$wgArticlePath = “/$1″;
$wgUsePathInfo = false;
2:在.htaccess中加入下面的内容
RewriteEngine On
RewriteRule ^[^:]*\. –
RewriteRule ^[^:]*\/ –
RewriteRule ^/*$ /index.php?title=Main_Page
RewriteRule ^(.+)$ /index.php?title=$1
升级或安装时最好把这些先恢复默认,否则会出错,如果时间久了,会很难想到是这个错误。
补充:
用以上的规则,如果标题包含”.”就会无法显示,使用下面的正常
RewriteEngine on
RewriteCond %{REQUEST_URI} !index.php
RewriteCond %{REQUEST_FILENAME}-f
RewriteCond %{REQUEST_FILENAME}-d
RewriteCond %{REQUEST_FILENAME}-l
RewriteRule^(.+)/home/vvkicom/public_html/$1
# redirect to main page
RewriteRule ^/*$ /index.php?title=Main_Page
# anything else is to be treated as a title
RewriteCond %{REQUEST_URI} !index.php
RewriteRule ^(.+)$ /index.php?title=$1
页:
[1]