开发者

Index files for Subdomains

开发者 https://www.devze.com 2023-01-02 22:16 出处:网络
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

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.

My theory is that when I visit sub.domain.com, the index file it searches fo开发者_开发问答r 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.


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

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

Add the following

DirectoryIndex 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

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

0

精彩评论

暂无评论...
验证码 换一张
取 消