- 论坛徽章:
- 0
|
系统是CentOS 4.3,安装的apache版本是2.2.4
编译参数是:
./configure \
--with-apr=/usr/local/apr \
--with-apr-util=/usr/local/apr-util \
--enable-so \
--enable-rewrite \
--enable-proxy \
--enable-proxy-http \
--enable-expires
本来没有前两行“--with-apr”的,但是make的时候出现过apr错误的提示,然后单独编译了srclib/apr、srclib/apr-util,之后用上面的参数编译成功了。
测试apache/php都正常的。
另外在extra/httpd-vhosts.conf中建了几个虚拟主机。文件内容如下:
RewriteEngine On
RewriteLogLevel 9
RewriteLog logs/rewrite_log
NameVirtualHost *:80
<VirtualHost *:80>
DocumentRoot /home/www/htdocs
php_flag engine off
</VirtualHost>
<VirtualHost *:80>
DocumentRoot /home/www/test
ServerName 234.test.com
RewriteRule ^([\d]+)/(.{2,20}).html$ http://123.test.com/test.php?name1=$1&name2=$2 [R]
<IfModule dir_module>
DirectoryIndex index.php
</IfModule>
<Directory />
Options Indexes FollowSymLinks
AllowOverride All
Order allow,deny
Allow from all
</Directory>
Alias /js /home/www/htdocs/js
Alias /images /home/www/htdocs/images
Alias /css /home/www/htdocs/css
</VirtualHost>
其他几个虚拟主机内容都是基本的,只是ServerName和DocumentRoot对应了而已。
上述配置没有出错,正常启动了Apache。
但是Rewrite引擎没反映。。。logs/rewrite_log是空文件。
由于“AllowOverride All”,我又在“/home/www/test”里单独写了一个文件:“.httpaccess”
内容大概是:
RewriteEngine On
RewriteOptions MaxRedirects=1
RewriteRule ^([\d]+)/(.{2,20}).html$ http://123.test.com/test.php?name1=$1&name2=$2 [R]
跟前面一样,rewrite引擎无效。
另外,请不要怀疑RewriteRule指令,同样内容的语句在另一台服务器上正常运行的,且那台服务器的apache编译参数是一样的。。。
何解?
先谢谢啦。 |
|