0
我有一個虛擬主機:www.example.com
,其中包含2個子文件夾,即hello
和hello2
。 hello
不包含任何內容,而hello2
包含test.html
文件。
將特定文件夾重定向到另一個文件夾並使用httpd.conf加載特定頁面
現在我想要做的是,每當我訪問www.example.com/hello
我想要的頁面訪問test.html
在hello2
子文件夾。
輸出示例:
網址: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>
預先感謝您。