0

我在我的网络服务器上设置了一个子域(如 subdomain.domain.com)。主站点位于“httpdocs”中,子域的文件位于与“httpdocs”相同级别的“子域”文件夹中。“httpdocs”中没有 .htaccess 文件。我在“子域”文件夹中有 .htaccess 文件:

DirectoryIndex index.html index.htm index.php

我想要的是在浏览器中调用 htpp://subdomain.domain.com 时首先打开 index.html 。但我收到 500 内部服务器错误。

有没有办法调整 .htaccess 文件来实现这一点,或者可能是一种解决方法?

谢谢!

4

2 回答 2

0

A 500 Internal Server Error could be caused by having incorrect permissions on your .htaccess file.

chmod 644 .htaccess

if I understand your directory structure correctly as being ~/httpdocs/subdomain/ you will also need a rewrite rule. The following should work.

DirectoryIndex index.html index.htm index.php

RewriteEngine on

RewriteCond %{HTTP_HOST} ^(.*)\.domain\.com
RewriteRule ^(.*)$ http://domain.com/subdomain/%1/$1 [L,NC,QSA]
于 2013-02-18T12:38:29.847 回答
0

根据错误日志中的消息,您的.htaccess文件具有 UTF-8 字节顺序标记。尝试将其保存为纯 ASCII。

于 2013-02-18T15:11:37.087 回答