php - 尝试在 dokuwiki 上使用 Apache 重写时出现 404 错误

标签 php apache .htaccess mod-rewrite dokuwiki

我正在使用 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/

相关文章:

php - 有没有其他选择去死?

php - 这个简单的 SQL 查询中有什么语法错误?

php 返回整个 html 文件而不是字符串 (ajax)

c - 为什么 Apache MPM prefork.c 使用互斥量来保护 accept()?

.htaccess - htaccess 带空格的文件名损坏

.htaccess - Notepad++ 中的.htaccess

php - PHP 中 Session 相对于 Cookie 的优势

apache - 将 RewriteRules 合并到 .htaccess 中,以便忽略特定查询参数

apache - 基于目录的多个文档根?

javascript - 缓存 uploadify 文件会使 chrome 崩溃