2013-10-30 58 views
0

我遇到了文档根目录的问题。我可以通过指定 http://mysite.com/index.html来获得index.html的方式,是否可以通过http://mysite.com自动将其重定向到index.html?apache2 web服务器index.html问题

的ServerAdmin [email protected]

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, 

回答

1

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

你的情况,这可能是工作:

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

的伟大工程!谢谢! – user2936194