【发布时间】:2014-02-12 00:28:03
【问题描述】:
我有一个虚拟主机:www.example.com,其中包含两个子文件夹,即hello 和hello2。 hello 不包含任何内容,而 hello2 包含 test.html 文件。
现在我想做的是,每当我访问www.example.com/hello 时,我希望页面访问hello2 子文件夹中的test.html。
样本输出:
网址:www.example.com/hello
回车后,
网址:www.example.com/hello2/test.html
页面显示:这是test.html
没有使用.htaccess只需使用httpd.conf配置,我怎么能做到这一点。我已经被困了好几个小时了。
这是我尝试过但没有运气的方法
<VirtualHost *:80>
DocumentRoot /var/www/www.example.com/hello
ServerName www.example.com
ServerAlias www.example.com
Alias /hello /var/www/www.example.com/hello2
<Directory /var/www/www.example.com/hello2>
#Options FollowSymLinks
Options Indexes FollowSymLinks Includes ExecCGI
AllowOverride All
Order deny,allow
Allow from all
RewriteEngine on
RewriteRule ^/index\.html$ test.html [R]
</Directory>
</VirtualHost>
提前谢谢你。
【问题讨论】:
标签: php apache apache2 centos virtualhost