子域的索引文件 [英] Index files for Subdomains

查看:140
本文介绍了子域的索引文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我终于能够设置子域名,但现在我尝试自己访问子域名时遇到了问题。例如,当我访问sub.domain.com时,我得到一个页面未找到错误。但是,当我访问sub.domain.com/index.php时,我看到了我的页面。

I was finally able to setup subdomains but now I have a problem when I try and access the subdomain by itself. For instance, when I visit sub.domain.com, I get a page not found error. However, when I visit sub.domain.com/index.php, I see my page.

我的理论是,当我访问sub.domain.com时,索引它搜索的文件不在子文件夹中,而是在根文件夹中。我有directoryindex在index.php之前查找index.html。根目录中有一个index.html是必需的。因此,当我去sub.domain.com时,它认为sub.domain.com/index.html存在,但后来发现它并没有给我发送404.这是我的理论。我该如何解决这个问题?有任何想法吗?谢谢。

My theory is that when I visit sub.domain.com, the index file it searches for is not in the sub/ folder but instead in the root folder. I have directoryindex to look for index.html before index.php. There is a index.html in the root directory that is needed. So when I go to sub.domain.com, it thinks that sub.domain.com/index.html exists but then finds out it doesnt and sends me a 404. That is my theory. How would I fix this? Any ideas? Thanks.

推荐答案

我假设你使用的是apache服务器。

I'm assuming that you are using an apache server.

DirectoryIndex指令允许您指定特定的文件名或文件名作为目录中的默认页面。

DirectoryIndex directive allows you to specify a specific filename or filenames as the default page in a directory.

配置文件在一行中会说明这一点:

There in a line the the configuration file which will say this:

DirectoryIndex index.html

DirectoryIndex index.html

添加以下内容

DirectoryIndex index.php index.html

DirectoryIndex index.php index.html

这将指定子域的默认页面的优先顺序。在index.php的情况下,然后index.html

This will specify the order of precedence for the default page of the subdomain. In the case index.php then index.html

如果子域找不到index.php那么它应该转到正确的索引页面

The sub domain should then go to the correct index page if it does not find index.php it will take the

这篇关于子域的索引文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆