用户工具

站点工具


dokuwiki的url重写设置

dokuwiki的URL重写设置

默认状态下dokuwiki的地址里面带有doku.php路径。在高级设置里有个userewrite(使用更简洁的url)的选项,选择 无或内部控制都带有doku.php。其实是可以去掉的。

后台设置

在后台配置设置→高级设置→使用更简洁的url中选择 .htaccess 选项,然后保存。这时访问会发现页面出现404错误,这是没有配置.htaccess文件所致。

配置.htaccess

其实dokuwiki默认已经写好了htaccess的规则,不过还要具体配置下。

复制.htaccess.dist 文件 为 .htaccess ,使用vim或其他文本编辑器打开,然后进行修改,具体修改如下:

## Enable this to restrict editing to logged in users only

## You should disable Indexes and MultiViews either here or in the
## global config. Symlinks maybe needed for URL rewriting.
#Options -Indexes -MultiViews +FollowSymLinks

## make sure nobody gets the htaccess, README, COPYING or VERSION files
<Files ~ "^([\._]ht|README$|VERSION$|COPYING$)">
    Order allow,deny
    Deny from all
    Satisfy All
</Files>

## Uncomment these rules if you want to have nice URLs using
## $conf['userewrite'] = 1 - not needed for rewrite mode 2
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 /
#
## 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 /这里是个关键,这里是根据具体安装路径进行设定的,我安装在根目录下,直接写做 / 就可以

dokuwiki的url重写设置.txt · 最后更改: 2014/03/24 04:09 由 bjzhangxin