我正在使用 dokuwiki 构建一个 wiki,并且正在使用漂亮的 URL 功能,该功能通过网络服务器上的 Apache 重写 url,以摆脱难看的 php url。我的问题是,在使用新 URL 搜索页面时,我似乎只收到 404 Not Found 错误。
这是提供的 .htaccess 文件,RewriteBase 指向正确的位置。
#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
</Files>
## Uncomment these rules if you want to have nice URLs using
## $conf['userewrite'] = 1 - not needed for rewrite mode 2
RewriteEngine on
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
## 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]
最佳答案
确保您的 Apache 确实加载了 .htaccess 文件。您可能会在 Apache 配置中需要它:
AllowOverride All
关于php - 尝试在 dokuwiki 上使用 Apache 重写时出现 404 错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31522046/