Forum Moderators: phranque

Message Too Old, No Replies

Apache not serving .htm or .css files

Apache only serving .php files

         

dgriffter

11:28 am on Sep 7, 2005 (gmt 0)

10+ Year Member



Hi,

I am running Apache 2 on windows XP and have been for over a year with no problems. Yesterday I tried to use Apache to test some work I've been doing before putting it live and I realised that none of my .htm or .html files were being served. It seems that only .php files are being served at present. I had not touched the httpd.conf file or messed about with any settings that I can think might have caused things not to work.
I am a web geek, but not a server wizard. I have hunted high and low on the internet for a solution. I tried the AddType for .htm with no luck.
I am at a loss and need to test my work.

I would appreciate any help in this matter.

Many thanks in anticipation,

Dgriffter

ChadSEO

2:36 pm on Sep 7, 2005 (gmt 0)

10+ Year Member



Dgriffter,

Welcome to WebmasterWorld!

When you saying it's not serving .htm/.html files, what exactly does it do when you try to access those files? Do you get an error message/error code? Are there any entries in the error log?

One place to check would be the mime.types file in the \conf\ directory. Make sure it has the following line:

text/html html htm

Chad

dgriffter

4:23 pm on Sep 7, 2005 (gmt 0)

10+ Year Member



Hi Chad,

Thank you for your quick response. Ok, so when I try to access the files, I can see the folder structure in my browser window. Php files are served correctly, but when I try to access .htm or .html files, Mozilla Firefox does nothing at all (no message, no code, nothing) and IE 6 says "can't find server or DNS error". The error log entries show nothing and the access log gives the following:

127.0.0.1 - - [07/Sep/2005:18:18:00 +0200] "GET /sincarne1/index.htm HTTP/1.1" 200 7417

which I understand to be a successful request response from Apache.

I have checked the mime.types file and it correctly shows the entry you suggested.

Thanks for the welcome and once again for your help,

Dgriffter

ChadSEO

4:39 pm on Sep 7, 2005 (gmt 0)

10+ Year Member



Dgriffter,

Let me just make sure I'm understanding you. When you try to access http://www.example.com/somefile.php, then it works, but when you try http://www.example.com/otherfile.html, you get no response in Firefox, and the DNS error in IE?

You also mentioned seeing the folder structure. This will normally happen when you try to access http://www.example.com/directory/, if there is no index page in that directory. An index page is normally index.(htm¦html¦php) or default.(htm¦html¦php). It shouldn't happen when trying to access http://www.example.com/directory/file.html though.

Chad

dgriffter

5:09 pm on Sep 7, 2005 (gmt 0)

10+ Year Member



Chad,

You've got it. That's exactly what's happening. It serves up the .php files and makes the correct database accesses, etc. However, when I try [localhost...] it does as I explained.

Any ideas?

Cheers,

Dgriffter

jdMorgan

8:58 pm on Sep 7, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I'd suggest testing a php page and an html page using the server headers checker [webmasterworld.com]. Compare the results from testing these two filetypes on your own site to the results of testing such pages on a known-working site. I suspect you'll see a difference in the MIME-type headers returned, because that can sometimes cause these kinds of problems.

Also, be on the lookout for unexpected redirects -- That's the only mechanism I can think of where *all* .html requests would give you the server directory listing. You'll see a 301 or 302 response code instead of the expected 200-OK. It's also possible that it's an unexpected internal rewrite that's doing this. An error in mod_rewrite code added by you or your host (manually or by using a "control panel") could be responsible.

If you do make changes to your configuration settings in httpd.conf, .htaccess, etc., then be sure to flush your browser caches before testing again. Otherwise, you're likely to see "stale" cached results.

Jim

dgriffter

11:15 pm on Sep 21, 2005 (gmt 0)

10+ Year Member



Hi all,

Thanks again for the help - I reinstalled Apache in the end and everything works fine now. Probably should have just done so in the first place, but we learn... No idea what the problem can have been...

Dgriffter