Apache 2 Web 服务器索引.html问题



我在文档根目录方面遇到问题。我可以访问我的索引.html方法是通过指定http://mysite.com/index.html,有没有办法让它自动重定向到索引.html http://mysite.com?

服务器管理员 webmaster@mysite.com

    DocumentRoot /var/www/mysite.com
    <Directory />
            Options FollowSymLinks
            AllowOverride None
    </Directory>
    <Directory /var/www/mysite.com>
            Options Indexes FollowSymLinks MultiViews
            AllowOverride None
            Order allow,deny
            allow from all
    </Directory>
    ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
    <Directory "/usr/lib/cgi-bin">
            AllowOverride None
            Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
            Order allow,deny
            Allow from all
    </Directory>
    ErrorLog /var/log/apache2/error.log
    # Possible values include: debug, info, notice, warn, error, crit,

您需要将 DirectoryIndex 添加到主机配置中。这基本上告诉服务器如果请求中没有指定文件,要查找哪些文件。

在您的情况下,这可能有效:

<Directory /var/www/mysite.com>
        DirectoryIndex index.html
        Options Indexes FollowSymLinks MultiViews
        AllowOverride None
        Order allow,deny
        allow from all
</Directory>

最新更新