Index.html is not working


I have successfully added my second domain but when I visit it through browser, it shows me the directory rather then the web page. What shall I do?

Thank and regards

It sounds as though you may have the index.html installed in the wrong directory, or you have misspelled “index.html” (CaSE Is iMpoRtant ) - can you give us a link to your second domain?

Your user directory should look something like this:/home/user/ | v yourfirstdomain.tld/ | | | v index.html | v yourseconddomain.tld/ | | | v [color=#0000CC] index.html [/color] Make sure the index.html file for your second domain is in the place in your file structure indicated by the [color=#0000CC]blue[/color] text above.



Thanks for the reply; following is the control panel structure:

–index.html (works fine)
–index.html (brings directory rather then index.html)
.bash profile

If I could see the directory listing for that second domain, I might be able to tell what is happening. You have confirmed that there is an “index.html” in that second domain’s “web root” dir (in your structure, “SecodDoamin”)?


Yes, I have put an index.html file in a domain root and theoretically it has to be come on to the screen when I visit the domain but it is not happening, is there is anything which requires changes in control panel or what, I am bit confuse.

nothing should need to be dome in the control panel - can you see the index.html in the directory listing that is displayed when you browse to the domain?


Is that “.hraccss” file really an “.htaccess” file in you home/user directory and, if so, why is it there and what is it’s contents?

Do you have an “.htaccess” file in your second domain’s directory and, if so, why is it there and what does it contain?


Sorry it was not hraccess it is htaccess and it is only at the main root, not in the second domain root and yes when I visit my second domain, it shows me the directory content which also has index.html file.

My first domain has htaccess file unlike my second domain, which has no htaccess file. Is that make some sense about that issue?

It could well have an effect. Try temporarily renaming the .htaccess file in your main root (say, to “htaccess.txt” you can always name it back later, though you probably should not have it there at all), clear your browser’s cache, and browse to your second domain again.

See if you now see the index.html file displayed. :wink:


After renaming the htaccess file, my both domains are working fine :slight_smile: but when I have renamed htaccess back to the normal it again gives me the same error, can I leave that file as .htaacess.txt file or is it used by server?

Ok. here is what is happening:

The .htaccess file(s) provide directives to the Apache webserver that effect how the server operates on any directory it resides in and all directories beneath it. This can be over-ridden by another .htaccess in a lower level directory.

This is why your first domain works as you expect, but the second one didn’t - the .htaccess file in your “main” directory (/home/username/) would impact the server operation for both the firstdomain.tld and the seconddomain.tld subdirectories except for the fact that it’s operation was “over-ridden” for the firstdomain.tld subdirectory, because another .htaccess file (in that directory) “superseded” it.

As there was no such “superseding .htaccess” file in the seconddomain.tld subdirectory, whatever directives the “main” directory’s .htaccess file contained were applied to the seconddomain.tld subdirectory.

That is why I asked about the contents of the .htaccess file - since you did not provide that in response to my question, I can not tell exactly what the directive was that caused the problem, but I suspect that it was an .htaccess file for another web application that prevented the index.html from being automatically displayed (several directives could be responsible for this).

All that said, and not knowing exactly what that .htaccess file in your “main” directory was designed to do or what it contains, I cannot advise you as to whether you need it or not - you certianly do not need it with it’s current contents, if you want index.html to be automatically displayed when a browser visits

You can begin to learn about how .htaccess works by studying this Apache .htaccess “How To” (tutorial). Note that what you experienced is described in the section of the tutorial that states:

[i]"Apache must look for .htaccess files in all higher-level directories, in order to have a full complement of directives that it must apply. (See section on how directives are applied.) Thus, if a file is requested out of a directory /www/htdocs/example, Apache must look for the following files:


And so, for each file access out of that directory, there are 4 additional file-system accesses, even if none of those files are present. (Note that this would only be the case if .htaccess files were enabled for /, which is not usually the case.)"[/i]

I suspect that somehow the .htaccess file for your firstdomain got itself uploaded to the “main” directory, and caused the problem. I suggest you just leave it “renamed” in your “main” directory until you study the tutotial or, in some other way, determine what it is trying to do and how/where it should be placed if it is needed at all.

Leaving it where it is in a “renamed” condition will not hurt anything, and you may need to refer to it to figure out what it was trying to do. :wink:



Thanks for your detailed reply and as a rookie to the server side I am still in learning curve. Your’s given examples and sample link to the Apache really helps me a lot.

Thanks and regards

You are welcome! I’m happy to help, and I’m glad you got the index.html to show as you expected it to! :slight_smile: