apache 的vhost_alias 和.htaccess文件是不是有衝突?
我的apache版本是2.0.54,我使用了vhost_alias模塊來設置我的虛擬主機:
VirtualDocumentRoot /home/vhosts/%0/wwwroot
以便讓用戶可以在自己的虛擬主機目錄下使用.htaccess文件,但現在碰到的問題是如果不使用
VirtualDocumentRoot /home/vhosts/%0/wwwroot
直接用 DocumentRoot /home/vhosts/www.test.com/wwwroot
.htaccess文件起作用,但如果用
VirtualDocumentRoot /home/vhosts/%0/wwwroot
則出現500 Internal Server Error錯誤:
mod_rewrite: maximum number of internal redirects reached. Assuming
configuration error. Use 'RewriteOptions MaxRedirects' to increase the limit if neccessary.
mod_rewrite: maximum number of internal redirects reached. Assuming
configuration error. Use 'RewriteOptions MaxRedirects' to increase the limit if neccessary.
我想可能是,.htaccess文件里的設置和vhost_alias有衝突,應該怎樣設置呢?
/home/vhosts/www.test.com/wwwroot/.htaccess文件的內容如下:
RewriteEngine on
RewriteRule !\.(js|ico|gif|jpg|png|css)$ index.php
[ 本帖最後由 ptsmy 於 2006-5-23 11:37 編輯 ]
《解決方案》
頂一下
《解決方案》
這是我的日誌,是出在rewrite規則上面了,可怎麼設置才能讓vhost_alias和.htaccess共存呢
bash-2.03# more /usr/local/apache/logs/rewrite_log
222.41.64.205 - - (2) init rewrite engine with re
quested uri /foo/bar
222.41.64.205 - - (1) pass through /foo/bar
222.41.64.205 - - (3) [per-dir /home/vhosts/www.w
onniu.com/wwwroot/] add path info postfix: /home/vhosts/www.wonniu.com/wwwroot/foo -> /home/vhosts/www.wonniu.com/wwwroot/foo
/bar
222.41.64.205 - - (3) [per-dir /home/vhosts/www.w
onniu.com/wwwroot/] strip per-dir prefix: /home/vhosts/www.wonniu.com/wwwroot/foo/bar -> foo/bar
222.41.64.205 - - (3) [per-dir /home/vhosts/www.w
onniu.com/wwwroot/] applying pattern '.*$' to uri 'foo/bar'
222.41.64.205 - - (2) [per-dir /home/vhosts/www.w
onniu.com/wwwroot/] rewrite foo/bar -> index.php
222.41.64.205 - - (3) [per-dir /home/vhosts/www.w
onniu.com/wwwroot/] add per-dir prefix: index.php -> /home/vhosts/www.wonniu.com/wwwroot/index.php
222.41.64.205 - - (1) [per-dir /home/vhosts/www.w
onniu.com/wwwroot/] internal redirect with /home/vhosts/www.wonniu.com/wwwroot/index.php
222.41.64.205 - - (2) init rewrite engine
with requested uri /home/vhosts/www.wonniu.com/wwwroot/index.php
222.41.64.205 - - (1) pass through /home/
vhosts/www.wonniu.com/wwwroot/index.php
222.41.64.205 - - (3) [per-dir /home/vhos
ts/www.wonniu.com/wwwroot/] add path info postfix: /home/vhosts/www.wonniu.com/wwwroot/home -> /home/vhosts/www.wonniu.com/ww
wroot/home/vhosts/www.wonniu.com/wwwroot/index.php
222.41.64.205 - - (3) [per-dir /home/vhos
ts/www.wonniu.com/wwwroot/] strip per-dir prefix: /home/vhosts/www.wonniu.com/wwwroot/home/vhosts/www.wonniu.com/wwwroot/inde
x.php -> home/vhosts/www.wonniu.com/wwwroot/index.php
222.41.64.205 - - (3) [per-dir /home/vhos
ts/www.wonniu.com/wwwroot/] applying pattern '.*$' to uri 'home/vhosts/www.wonniu.com/wwwroot/index.php'
222.41.64.205 - - (2) [per-dir /home/vhos
ts/www.wonniu.com/wwwroot/] rewrite home/vhosts/www.wonniu.com/wwwroot/index.php -> index.php
222.41.64.205 - - (3) [per-dir /home/vhos
ts/www.wonniu.com/wwwroot/] add per-dir prefix: index.php -> /home/vhosts/www.wonniu.com/wwwroot/index.php
222.41.64.205 - - (1) [per-dir /home/vhos
ts/www.wonniu.com/wwwroot/] internal redirect with /home/vhosts/www.wonniu.com/wwwroot/index.php
222.41.64.205 - - (2) init rewrite engine
with requested uri /home/vhosts/www.wonniu.com/wwwroot/index.php
222.41.64.205 - - (1) pass through /home/
vhosts/www.wonniu.com/wwwroot/index.php
222.41.64.205 - - (3) [per-dir /home/vhos
ts/www.wonniu.com/wwwroot/] add path info postfix: /home/vhosts/www.wonniu.com/wwwroot/home -> /home/vhosts/www.wonniu.com/ww
wroot/home/vhosts/www.wonniu.com/wwwroot/index.php
222.41.64.205 - - (3) [per-dir /home/vhos
ts/www.wonniu.com/wwwroot/] strip per-dir prefix: /home/vhosts/www.wonniu.com/wwwroot/home/vhosts/www.wonniu.com/wwwroot/inde
x.php -> home/vhosts/www.wonniu.com/wwwroot/index.php
222.41.64.205 - - (3) [per-dir /home/vhos
ts/www.wonniu.com/wwwroot/] applying pattern '.*$' to uri 'home/vhosts/www.wonniu.com/wwwroot/index.php'
222.41.64.205 - - (2) [per-dir /home/vhos
ts/www.wonniu.com/wwwroot/] rewrite home/vhosts/www.wonniu.com/wwwroot/index.php -> index.php
222.41.64.205 - - (3) [per-dir /home/vhos
ts/www.wonniu.com/wwwroot/] add per-dir prefix: index.php -> /home/vhosts/www.wonniu.com/wwwroot/index.php
222.41.64.205 - - (1) [per-dir /home/vhos
ts/www.wonniu.com/wwwroot/] internal redirect with /home/vhosts/www.wonniu.com/wwwroot/index.php
222.41.64.205 - - (2) init rewrite engine
with requested uri /home/vhosts/www.wonniu.com/wwwroot/index.php
222.41.64.205 - - (1) pass through /home/
vhosts/www.wonniu.com/wwwroot/index.php
222.41.64.205 - - (3) [per-dir /home/vhos
ts/www.wonniu.com/wwwroot/] add path info postfix: /home/vhosts/www.wonniu.com/wwwroot/home -> /home/vhosts/www.wonniu.com/ww
wroot/home/vhosts/www.wonniu.com/wwwroot/index.php
222.41.64.205 - - (3) [per-dir /home/vhos
ts/www.wonniu.com/wwwroot/] strip per-dir prefix: /home/vhosts/www.wonniu.com/wwwroot/home/vhosts/www.wonniu.com/wwwroot/inde
x.php -> home/vhosts/www.wonniu.com/wwwroot/index.php
222.41.64.205 - - (3) [per-dir /home/vhos
ts/www.wonniu.com/wwwroot/] applying pattern '.*$' to uri 'home/vhosts/www.wonniu.com/wwwroot/index.php'
222.41.64.205 - - (2) [per-dir /home/vhos
ts/www.wonniu.com/wwwroot/] rewrite home/vhosts/www.wonniu.com/wwwroot/index.php -> index.php
222.41.64.205 - - (3) [per-dir /home/vhos
ts/www.wonniu.com/wwwroot/] add per-dir prefix: index.php -> /home/vhosts/www.wonniu.com/wwwroot/index.php
222.41.64.205 - - (1) [per-dir /home/vhos
ts/www.wonniu.com/wwwroot/] internal redirect with /home/vhosts/www.wonniu.com/wwwroot/index.php
222.41.64.205 - - (2) init rewrite engine
with requested uri /home/vhosts/www.wonniu.com/wwwroot/index.php
222.41.64.205 - - (1) pass through /home/
vhosts/www.wonniu.com/wwwroot/index.php
222.41.64.205 - - (3) [per-dir /home/vhos
ts/www.wonniu.com/wwwroot/] add path info postfix: /home/vhosts/www.wonniu.com/wwwroot/home -> /home/vhosts/www.wonniu.com/ww
wroot/home/vhosts/www.wonniu.com/wwwroot/index.php
222.41.64.205 - - (3) [per-dir /home/vhos
ts/www.wonniu.com/wwwroot/] strip per-dir prefix: /home/vhosts/www.wonniu.com/wwwroot/home/vhosts/www.wonniu.com/wwwroot/inde
x.php -> home/vhosts/www.wonniu.com/wwwroot/index.php
222.41.64.205 - - (3) [per-dir /home/vhos
ts/www.wonniu.com/wwwroot/] applying pattern '.*$' to uri 'home/vhosts/www.wonniu.com/wwwroot/index.php'
222.41.64.205 - - (2) [per-dir /home/vhos
ts/www.wonniu.com/wwwroot/] rewrite home/vhosts/www.wonniu.com/wwwroot/index.php -> index.php
222.41.64.205 - - (3) [per-dir /home/vhos
ts/www.wonniu.com/wwwroot/] add per-dir prefix: index.php -> /home/vhosts/www.wonniu.com/wwwroot/index.php
222.41.64.205 - - (1) [per-dir /home/vhos
ts/www.wonniu.com/wwwroot/] internal redirect with /home/vhosts/www.wonniu.com/wwwroot/index.php
222.41.64.205 - - (2) init rewrite engine
with requested uri /home/vhosts/www.wonniu.com/wwwroot/index.php
222.41.64.205 - - (1) pass through /home/
vhosts/www.wonniu.com/wwwroot/index.php
222.41.64.205 - - (3) [per-dir /home/vhos
ts/www.wonniu.com/wwwroot/] add path info postfix: /home/vhosts/www.wonniu.com/wwwroot/home -> /home/vhosts/www.wonniu.com/ww
wroot/home/vhosts/www.wonniu.com/wwwroot/index.php
222.41.64.205 - - (3) [per-dir /home/vhos
ts/www.wonniu.com/wwwroot/] strip per-dir prefix: /home/vhosts/www.wonniu.com/wwwroot/home/vhosts/www.wonniu.com/wwwroot/inde
x.php -> home/vhosts/www.wonniu.com/wwwroot/index.php
222.41.64.205 - - (3) [per-dir /home/vhos
ts/www.wonniu.com/wwwroot/] applying pattern '.*$' to uri 'home/vhosts/www.wonniu.com/wwwroot/index.php'
222.41.64.205 - - (2) [per-dir /home/vhos
ts/www.wonniu.com/wwwroot/] rewrite home/vhosts/www.wonniu.com/wwwroot/index.php -> index.php
222.41.64.205 - - (3) [per-dir /home/vhos
ts/www.wonniu.com/wwwroot/] add per-dir prefix: index.php -> /home/vhosts/www.wonniu.com/wwwroot/index.php
222.41.64.205 - - (1) [per-dir /home/vhos
ts/www.wonniu.com/wwwroot/] internal redirect with /home/vhosts/www.wonniu.com/wwwroot/index.php
222.41.64.205 - - (2) init rewrite engine
with requested uri /home/vhosts/www.wonniu.com/wwwroot/index.php
222.41.64.205 - - (1) pass through /home/
vhosts/www.wonniu.com/wwwroot/index.php
222.41.64.205 - - (3) [per-dir /home/vhos
ts/www.wonniu.com/wwwroot/] add path info postfix: /home/vhosts/www.wonniu.com/wwwroot/home -> /home/vhosts/www.wonniu.com/ww
wroot/home/vhosts/www.wonniu.com/wwwroot/index.php
222.41.64.205 - - (3) [per-dir /home/vhos
ts/www.wonniu.com/wwwroot/] strip per-dir prefix: /home/vhosts/www.wonniu.com/wwwroot/home/vhosts/www.wonniu.com/wwwroot/inde
x.php -> home/vhosts/www.wonniu.com/wwwroot/index.php
222.41.64.205 - - (3) [per-dir /home/vhos
ts/www.wonniu.com/wwwroot/] applying pattern '.*$' to uri 'home/vhosts/www.wonniu.com/wwwroot/index.php'
222.41.64.205 - - (2) [per-dir /home/vhos
ts/www.wonniu.com/wwwroot/] rewrite home/vhosts/www.wonniu.com/wwwroot/index.php -> index.php
222.41.64.205 - - (3) [per-dir /home/vhos
ts/www.wonniu.com/wwwroot/] add per-dir prefix: index.php -> /home/vhosts/www.wonniu.com/wwwroot/index.php
222.41.64.205 - - (1) [per-dir /home/vhos
ts/www.wonniu.com/wwwroot/] internal redirect with /home/vhosts/www.wonniu.com/wwwroot/index.php
222.41.64.205 - - (2) init rewrite engine
with requested uri /home/vhosts/www.wonniu.com/wwwroot/index.php
222.41.64.205 - - (1) pass through /home/
vhosts/www.wonniu.com/wwwroot/index.php
222.41.64.205 - - (3) [per-dir /home/vhos
ts/www.wonniu.com/wwwroot/] add path info postfix: /home/vhosts/www.wonniu.com/wwwroot/home -> /home/vhosts/www.wonniu.com/ww
wroot/home/vhosts/www.wonniu.com/wwwroot/index.php
222.41.64.205 - - (3) [per-dir /home/vhos
ts/www.wonniu.com/wwwroot/] strip per-dir prefix: /home/vhosts/www.wonniu.com/wwwroot/home/vhosts/www.wonniu.com/wwwroot/inde
x.php -> home/vhosts/www.wonniu.com/wwwroot/index.php
222.41.64.205 - - (3) [per-dir /home/vhos
ts/www.wonniu.com/wwwroot/] applying pattern '.*$' to uri 'home/vhosts/www.wonniu.com/wwwroot/index.php'
222.41.64.205 - - (2) [per-dir /home/vhos
ts/www.wonniu.com/wwwroot/] rewrite home/vhosts/www.wonniu.com/wwwroot/index.php -> index.php
222.41.64.205 - - (3) [per-dir /home/vhos
ts/www.wonniu.com/wwwroot/] add per-dir prefix: index.php -> /home/vhosts/www.wonniu.com/wwwroot/index.php
222.41.64.205 - - (1) [per-dir /home/vhos
ts/www.wonniu.com/wwwroot/] internal redirect with /home/vhosts/www.wonniu.com/wwwroot/index.php
222.41.64.205 - - (2) init rewrite engine
with requested uri /home/vhosts/www.wonniu.com/wwwroot/index.php
222.41.64.205 - - (1) pass through /home/
vhosts/www.wonniu.com/wwwroot/index.php
222.41.64.205 - - (3) [per-dir /home/vhos
ts/www.wonniu.com/wwwroot/] add path info postfix: /home/vhosts/www.wonniu.com/wwwroot/home -> /home/vhosts/www.wonniu.com/ww
wroot/home/vhosts/www.wonniu.com/wwwroot/index.php
222.41.64.205 - - (3) [per-dir /home/vhos
ts/www.wonniu.com/wwwroot/] strip per-dir prefix: /home/vhosts/www.wonniu.com/wwwroot/home/vhosts/www.wonniu.com/wwwroot/inde
x.php -> home/vhosts/www.wonniu.com/wwwroot/index.php
222.41.64.205 - - (3) [per-dir /home/vhos
ts/www.wonniu.com/wwwroot/] applying pattern '.*$' to uri 'home/vhosts/www.wonniu.com/wwwroot/index.php'
222.41.64.205 - - (2) [per-dir /home/vhos
ts/www.wonniu.com/wwwroot/] rewrite home/vhosts/www.wonniu.com/wwwroot/index.php -> index.php
222.41.64.205 - - (3) [per-dir /home/vhos
ts/www.wonniu.com/wwwroot/] add per-dir prefix: index.php -> /home/vhosts/www.wonniu.com/wwwroot/index.php
222.41.64.205 - - (1) [per-dir /home/vhos
ts/www.wonniu.com/wwwroot/] internal redirect with /home/vhosts/www.wonniu.com/wwwroot/index.php
222.41.64.205 - - (2) init rewrite engine
with requested uri /home/vhosts/www.wonniu.com/wwwroot/index.php
222.41.64.205 - - (1) pass through /home/
vhosts/www.wonniu.com/wwwroot/index.php
222.41.64.205 - - (3) [per-dir /home/vhos
ts/www.wonniu.com/wwwroot/] add path info postfix: /home/vhosts/www.wonniu.com/wwwroot/home -> /home/vhosts/www.wonniu.com/ww
wroot/home/vhosts/www.wonniu.com/wwwroot/index.php
222.41.64.205 - - (3) [per-dir /home/vhos
ts/www.wonniu.com/wwwroot/] strip per-dir prefix: /home/vhosts/www.wonniu.com/wwwroot/home/vhosts/www.wonniu.com/wwwroot/inde
x.php -> home/vhosts/www.wonniu.com/wwwroot/index.php
222.41.64.205 - - (3) [per-dir /home/vhos
ts/www.wonniu.com/wwwroot/] applying pattern '.*$' to uri 'home/vhosts/www.wonniu.com/wwwroot/index.php'
222.41.64.205 - - (2) [per-dir /home/vhos
ts/www.wonniu.com/wwwroot/] rewrite home/vhosts/www.wonniu.com/wwwroot/index.php -> index.php
222.41.64.205 - - (3) [per-dir /home/vhos
ts/www.wonniu.com/wwwroot/] add per-dir prefix: index.php -> /home/vhosts/www.wonniu.com/wwwroot/index.php
bash-2.03#
《解決方案》
這是我的部分httpd.conf文件
UseCanonicalName Off
#
# DocumentRoot: The directory out of which you will serve your
# documents. By default, all requests are taken from this directory, but
# symbolic links and aliases may be used to point to other locations.
#
#DocumentRoot "/home/vhosts/www.wonniu.com/wwwroot"
VirtualDocumentRoot /home/vhosts/%0/wwwroot
RewriteEngine On
RewriteLog "logs/rewrite_log"
RewriteLogLevel 9
#RewriteOptions MaxRedirects=200
#
# Each directory to which Apache has access can be configured with respect
# to which services and features are allowed and/or disabled in that
# directory (and its subdirectories).
#
# First, we configure the "default" to be a very restrictive set of
# features.
#
<Directory />
Options FollowSymLinks
AllowOverride All
</Directory>
#
# Note that from this point forward you must specifically allow
# particular features to be enabled - so if something's not working as
# you might expect, make sure that you have specifically enabled it
# below.
#
#
# This should be changed to whatever you set DocumentRoot to.
#
#
# UserDir: The name of the directory that is appended onto a user's home
# directory if a ~user request is received.
#
#UserDir public_html
#
# Control access to UserDir directories. The following is an example
# for a site where these directories are restricted to read-only.
#
<Directory /home/vhosts/*/wwwroot>
Options FollowSymLinks
AllowOverride All
</Directory>
《解決方案》
vvvvvvvvvvvvvvvvvvvvvvvvvv