apache 2 not recognizing .shtml files
Hi,
I have just changed my web pages mostly to .shtml to take advantage of ssi. Now, when I go to my website, it gives an "index of /" page instead of showing the .shtml files. I have read in many places that .shtml files have to be specifically set up to be recognized as index files, but I cannot for the life of me get it to work or even to understand where I'm supposed to put all of the configuration stuff. I need to know what to change to make the apache 2 parse .shtml files for ssi and also to make apache check for .shtml files as an index file. Any help would be appreciated. Thanks, -Michael. P.S. I would also like to know how to make it so it will not by default show an "index of /" or whatever page when it does not find an index file. Also, I would need to know how to turn off this behavior for a particular directory. |
Hi,
You have to add index.shtml in the DirectoryIndex directive. For apache to parse .shtml pages (pages with ssi includes) you need to add Code:
AddType text/html .shtml If you don't want apache to do a directory listing when it cannot find an index page, then you have to remove the keyword "Indexes" from the Options of that directory. |
Hi,
Can you give me an example of a configuration file with this included. Also, where should I put it, in httpd.conf, in a specific website file, in apache2.conf, or what. Also, if it is httpd.conf, which one, the one under /etc/apache2 or /etc/apache2/conf.d So if you could help me by providing an example, that would be nice. -Michael. |
Quote:
There is actually 3 configuration files from when NCSA was writing it. They are still there but apache now recommends just using the httpd.conf only. So edit /etc/apache2/conf.d Nope I guess they took the 2 other conf files out. So just httpd.conf is the one you still want to edit anyways |
mmk,
Now how about an example, I am hopelessly lost around these conf files. Any help would be appreciated. -Michael. |
Did you google?
go to http://httpd.apache.org/docs/2.0/mod/mod_include.html and follow the documentation. If you make a change to a config you have to restart the service. But I have to ask why do you want to enable .shtml. You know if is for service side inludes, right?
|
Quote:
Yes I know this is for server side includes, that is what I have in my .shtml pages, that's why I need it enabled. I will try the link you posted. Thanks, -Michael. |
Hi,
I went there, and under the enabling server side includes, it said basically what everyone has told me to do, but nothing about where to put it, or what to put around it, or anything. If someone could give an example of a typical conf file, that would be nice. Also, I have placed that text in /etc/apache2/conf.d/httpd.conf and in /etc/apache2/httpd.conf and in /etc/apache2/sites-available/<mysite.mytld> but none of it seems to work. I reloaded and sometimes restarted the server after each changed. Any help is appreciated. -Michael. |
Hi,
I think that this could help you understand what you have to edit in order for apache to use SSI. Regards |
Hi,
I've got a few questions about that website now. Do those texts mentioned have to specifically be in the <directory /var/www/> or do they have to be in a <directory> tag that corrolates to your document root, such as <directory /websites/myhost.mydomain/public_html/> if my web files were in /websites/myhost.mydomain/public_html/ Because when I put them in the default file but put them in a <directory /websites/myhost.mydomain/public_html/> because that's my document root, it stills shows the index of / Any help, is as always, appreciated. -Michael. P.S. Thanks alot to all the people who have helped thus far, and I hope you can put up with me a little bit more :) |
With in..
the <Directory> tag is a perfect place for the entry.
|
Hi,
Thanks for the note that the <directory> tag is the place to put it. Unfortunately, it still isn't working. I put the text on the website mentioned in a previous post in the <directory /websites/mtgames.org/public_html/> tag, and also in the <directory /var/www/> tag, but none of it works. It should be noted that my files for the website are not in /var/www, but in /websites/mtgames.org/public_html/ I put the modifications in the mtgames.org virtual host file, and also in the default file. When I just put it in the mtgames.org file, it still gives me an index of /. When I put it in the default file, however, it says access forbidden. I did, it should be noted, remove the options indexes directive, just to test. Here is my virtual host file along with my default file, which are all the same. Quote:
-Michael. |
Hi,
I am still having terrible trouble getting it to work. I even tried using allowoverride all to do it in the .htaccess file, but no luck. It still says access forbidden! Any help is appreciated. -Michael. |
Have you added index.shtml in the DirectoryIndex directive as pointed out in the 2nd post?
Another thing you should take care, is that you have "DocumentRoot /websites/mtgames.org/public_html" for your vhost, but you change things for "<Directory /var/www/>". And you need a ServerName. Better use this: Code:
<VirtualHost *:80> |
Hi,
I did exactly as you said in your post, did the exact code you put there. Still saying access forbidden! I have the default and the mtgames.org page as the same thing, is that right? Also, it makes me think I'm missing something I need to do before or after reloaded apache2 So, when I modify and save the file, I do this: Quote:
I really don't know what's wrong, but I'm sure everyone is trying their best to help me. Thanks for a speedy reply, -Michael. |
All times are GMT -5. The time now is 05:45 AM. |