mediawiki短url的配置
/var/www/localhost/htdocs/mediawiki/w (installed as root user)
http://example.com/w/index.php/Page_title (recent versions of MediaWiki, unless using CGI)
http://example.com/w/index.php?title=Page_title (recent versions of MediaWiki, using CGI)
http://example.com/wiki/Page_title (标准访问url 像Wikipedia)
http://wiki.example.com/Page_title (不被推荐)
$wgScriptPath = “/w”; # Path to the actual files. This should already be there
$wgArticlePath = “/wiki/$1”; # Virtual path. This directory MUST be different from the one used in $wgScriptPath
$wgUsePathInfo = true; # Enable use of pretty URLs
Note that $wgScriptPath should already be set to /w. If it is not (for example, if you’re moving from a different URL scheme), make sure to set it to that.
Alias /wiki /path/to/your/wiki/index.php
. 注意 path 是文件在系统的绝对路径! This might be, for instance, Alias /wiki /var/www/w/index.php
,
或者 在web的根目录下编辑 .htaccess:
RewriteEngine On
RewriteRule ^wiki/(.*)$ /w/index.php?title=$1 [PT,L,QSA]
RewriteRule ^wiki/*$ /w/index.php [L,QSA]
RewriteRule ^/*$ /w/index.php [L,QSA]
RewriteRule defines virtual paths and how they should be rewritten; in the example above, /wiki/Page will cause /w/index.php?title=Page to be loaded instead.
如果使用的ISAPI_Rewrite,可以使用下面的配置内容:
RewriteCond %{QUERY_STRING} ^action=(.*)$
RewriteRule /wiki/(.*) /51667/index.php\?title=$2&action=$1
RewriteRule ^/*$ /51667/index.php&action=$1
Invalid command ‘RewriteEngine’, perhaps mis-spelled or defined by a module not included in the server configuration
打开httpd.conf ,取消 LoadModule rewrite_module modules/mod_rewrite.so前的注释
欢迎转载,请注明出处:亲亲宝宝