Apache 虚拟服务器重定向到index.php

use*_*ju7 3 apache virtualhost

我在运行 apache 2.4 的 Centos 6.5 上有以下虚拟主机配置。

<VirtualHost *:4323>
        ServerName www.first.com
        ServerAlias first.com
        DocumentRoot /var/www/first.com
        DirectoryIndex index.html
        RewriteEngine on
        RewriteRule ^index\.html$ index.php$1 [L,R=301]
        ErrorLog /var/www/first.com/log/error.log
        CustomLog /var/www/first.com/log/requests.log combined
</VirtualHost>
Run Code Online (Sandbox Code Playgroud)

当我进入server_IP:4323默认 HTTP 页面时出现。请问我怎样才能重定向到index.php工作状态?

配置httpd.conf这里

apache 详细信息如下 -

Server version: Apache/2.2.15 (Unix)
Server built:   Mar 22 2016 19:03:53
Server's Module Magic Number: 20051115:25
Server loaded:  APR 1.3.9, APR-Util 1.3.9
Compiled using: APR 1.3.9, APR-Util 1.3.9
Architecture:   64-bit
Server MPM:     Prefork
  threaded:     no
    forked:     yes (variable process count)
Server compiled with....
 -D APACHE_MPM_DIR="server/mpm/prefork"
 -D APR_HAS_SENDFILE
 -D APR_HAS_MMAP
 -D APR_HAVE_IPV6 (IPv4-mapped addresses enabled)
 -D APR_USE_SYSVSEM_SERIALIZE
 -D APR_USE_PTHREAD_SERIALIZE
 -D SINGLE_LISTEN_UNSERIALIZED_ACCEPT
 -D APR_HAS_OTHER_CHILD
 -D AP_HAVE_RELIABLE_PIPED_LOGS
 -D DYNAMIC_MODULE_LIMIT=128
 -D HTTPD_ROOT="/etc/httpd"
 -D SUEXEC_BIN="/usr/sbin/suexec"
 -D DEFAULT_PIDLOG="run/httpd.pid"
 -D DEFAULT_SCOREBOARD="logs/apache_runtime_status"
 -D DEFAULT_LOCKFILE="logs/accept.lock"
 -D DEFAULT_ERRORLOG="logs/error_log"
 -D AP_TYPES_CONFIG_FILE="conf/mime.types"
 -D SERVER_CONFIG_FILE="conf/httpd.conf"
Run Code Online (Sandbox Code Playgroud)

我看到错误[error] [client x.x.x.x] Directory index forbidden by Options directive: /var/www/first.com/

Har*_*rry 6

设置目录索引

DirectoryIndex index.php index.html
Run Code Online (Sandbox Code Playgroud)

在使用 mod_rewrite 之前,我会进行测试以确保其有效。