Python俱乐部
Python
小课题
京东优惠券
Dokuwiki提供三种URL网址格式,通过修改配置文件(dokuwiki.php)中的$conf['userewrite']值来实现:
下面是userewrite选项值的列表及其对应的URL格式:
$conf['userewrite'] = 0;
默认情况下,DokuWiki不做任何的URL重写,它的原始URL是这样的:
http://www.pythonclub.org/index.php?id=dokuwiki:start
这样的URL是比较难看的,更重要的是有些搜索引擎不收录,虽然google号称能够识别这些查询网址,但是这对SEO是非常不利的。
$conf['userewrite'] = 1;
.htaccess 是Apache服务器的配置文件,在dokuwiki所在的文件夹下面创建这个文件,文件内容为:
RewriteEngine on # Not all installations will require the following line. If you do, # change "/dokuwiki" to the path to your dokuwiki directory relative # to your document root. #RewriteBase /dokuwiki # If you enable DokuWikis XML-RPC interface, you should consider to # restrict access to it over HTTPS only! Uncomment the following two # rules if your server setup allows HTTPS. RewriteCond %{HTTPS} !=on RewriteRule ^lib/exe/xmlrpc.php$ https://%{SERVER_NAME}%{REQUEST_URI} [L,R=301] RewriteRule ^_media/(.*) lib/exe/fetch.php?media=$1 [QSA,L] RewriteRule ^_detail/(.*) lib/exe/detail.php?media=$1 [QSA,L] RewriteRule ^_export/([^/]+)/(.*) doku.php?do=export_$1&id=$2 [QSA,L] RewriteRule ^$ doku.php [L] RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule (.*) doku.php?id=$1 [QSA,L] RewriteRule ^index.php$ doku.php
其中有个参数是RewriteBase,是用来指定URL重写的目录,如果.htaccess文件就在dokuwiki所在的文件夹就不需要设置这个选项。
$conf['userewrite'] = 2;
这样设置就可以了,不需要设置Apache服务器的.htaccess文件了。