我已经在我的 apache 服务器的 / 路径上安装了一个 php 应用程序(dokuwiki),但我希望在某些 /mydir 路径上提供一些不同的文件(我的意思是与来自 dokuwiki 的文件不同的文件)。
目前,/mydir 只会在我的 dokuwiki 安装上弹出一个不存在的页面,但我希望在这里提供与 dokuwiki 内容非常不同的东西。
我在 /var/web/dokuwiki 服务器上安装了 dokuwiki,并将我想要提供的文件放在 /var/www/mydir 上
有没有办法配置 Apache 来提供我的文件而不干扰 dokuwiki 反之亦然?
当前的 dokuwiki 重写规则在 .htaccess 上有效:
## 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
</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 /
# 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]
答案1
那简单的呢Alias /mydir/ /var/www/mydir/
?您可能需要一个指令来允许访问/var/www/mydir
,但除此之外,这就可以正常工作。您甚至可以将您的别名放入网络服务器配置中,这样您就不必干扰您的 wiki 安装。