首页 > 未分类 > apache中mod_rewrite仅当配在虚机里时有效的问题

apache中mod_rewrite仅当配在虚机里时有效的问题

2007年8月26日 发表评论 阅读评论

今天在apache(httpd2.0.x)上配mod_rewrite
发现一个问题:
我本来是在/etc/httpd/conf.d/目录下单建的个文件来保存mod_rewrite的配置的
但奇怪的是在这里面的rewrite的设置并没有生效
琢磨了半天
把rewrite的设置写进相应的VirtualHost
再重启apache
居然生效了!!!
于是就有个困惑:为什么mod_rewrite的设置要写进<VirtualHost>里才会生效呢
终于,在apache的官方文档里看到关于RewriteEngine的一句话:

Note that, by default, rewrite configurations are not inherited. This means that you need to have a RewriteEngine on directive for each virtual host in which you wish to use it.

这样好像模模糊糊的解释了我的困惑
因为RewriteEngine在每个VirtualHost里缺省都是关掉的
那么当访问来的时候,写在VirtualHost外面的mod_rewrite的设置自然是看不到效果的

原创文章,转载请注明: 转载自嘻嘻哈哈的部落格(blog)

本文链接地址: apache中mod_rewrite仅当配在虚机里时有效的问题

分类: 未分类 标签: ,
  1. 本文目前尚无任何评论.
  1. 本文目前尚无任何 trackbacks 和 pingbacks.

*
To prove you're a person (not a spam script), type the security word shown in the picture. Click on the picture to hear an audio file of the word.
Click to hear an audio file of the anti-spam word