You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by Jonathan Hayward <ch...@gmail.com> on 2010/01/25 02:27:54 UTC

[users@httpd] Content-Type text.html for DirectoryIndex (1.3.x)

I am getting an error in my log if I visit
http://jonathanscorner.com/admin/but not
http://jonathanscorner.com/admin/index.html under Apache 1.3.x. The two
URL's serve up the same file; on a visit to
http://jonathanscorner.com/admin/ , DirectoryIndex pulls up the same
index.html (that directory has no index.cgi/index.php/etc.). The message
logged is:

[warn] Cannot get media type from 'text.html'

Is there any way in httpd.conf or .htaccess that I can get
DirectoryIndex-served files to be assigned Content-Type "text/html" and not
"text.html"? I haven't had success with variants on

<FilesMatch "^.*/$">
AddType text/html
</FilesMatch>

because AddType requires a second argument, an extension, and neither "" nor
* nor an omitted extension will match a directory with a trailing slash and
no extension.

Is there any way that DirectoryIndex-served files can be specified to be
text/html?

-- 
→ Jonathan Hayward, christos.jonathan.hayward@gmail.com
→ An Orthodox Christian author: theology, literature, et cetera.
→ My award-winning collection is available for free reading online:
☩ I invite you to visit my main site at http://JonathansCorner.com/

[users@httpd] Re: Content-Type text.html for DirectoryIndex (1.3.x)

Posted by Jonathan Hayward <ch...@gmail.com>.
I've found a partial workaround for this.

I commented out:

    #RewriteRule ^/index.html$ / [R=301,L]

And wrote another RewriteRule:

    RewriteRule ^(.*/)$ $1index.html [L]

The same URL is displayed; load http://jonathanscorner.com/admin/ and
the URL displayed in the browser window is the URL you typed in. But
besides the scenes it pulls the index.html file and sidesteps
DirectoryIndex before DirectoryIndex can assign a Content-Type of
"text.html" (or anything else).

N.B. I modified this to:

    RewriteRule ^/psalms/$ /psalms/index.cgi [L]
    RewriteRule ^(.+/)$ $1index.html [L]

as most directories have an index.html, but
http://jonathanscorner.com/ and http://jonathanscorner.com/psalms/ use
an index.cgi. As a later modification I moved the latter rule to the
end of the RewriteRules for that host, as it was preventing rewrites
from an old directory to a new directory.

I now can load URLs either like http://jonathanscorner.com/psalms/
(index.cgi) or http://jonathanscorner.com/dream/ (index.html) and have
the same browser behavior, but when I load it I don't get the
text.html warning in my error log.

So far since restarting I haven't seen any further text.html warnings.

I'd love to be able to fix the problem properly and at its source...

On Sun, Jan 24, 2010 at 7:27 PM, Jonathan Hayward
<ch...@gmail.com> wrote:
>
> I am getting an error in my log if I visit http://jonathanscorner.com/admin/ but not http://jonathanscorner.com/admin/index.html under Apache 1.3.x. The two URL's serve up the same file; on a visit to http://jonathanscorner.com/admin/ , DirectoryIndex pulls up the same index.html (that directory has no index.cgi/index.php/etc.). The message logged is:
>
> [warn] Cannot get media type from 'text.html'
>
> Is there any way in httpd.conf or .htaccess that I can get DirectoryIndex-served files to be assigned Content-Type "text/html" and not "text.html"? I haven't had success with variants on
>
> <FilesMatch "^.*/$">
> AddType text/html
> </FilesMatch>
>
> because AddType requires a second argument, an extension, and neither "" nor * nor an omitted extension will match a directory with a trailing slash and no extension.
>
> Is there any way that DirectoryIndex-served files can be specified to be text/html?
>
> --
> → Jonathan Hayward, christos.jonathan.hayward@gmail.com
> → An Orthodox Christian author: theology, literature, et cetera.
> → My award-winning collection is available for free reading online:
> ☩ I invite you to visit my main site at http://JonathansCorner.com/



--
→ Jonathan Hayward, christos.jonathan.hayward@gmail.com
→ An Orthodox Christian author: theology, literature, et cetera.
→ My award-winning collection is available for free reading online:
☩ I invite you to visit my main site at http://JonathansCorner.com/

---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] Content-Type text.html for DirectoryIndex (1.3.x)

Posted by Matus UHLAR - fantomas <uh...@fantomas.sk>.
On 24.01.10 19:27, Jonathan Hayward wrote:
> I am getting an error in my log if I visit
> http://jonathanscorner.com/admin/but not
> http://jonathanscorner.com/admin/index.html under Apache 1.3.x. The two
> URL's serve up the same file; on a visit to
> http://jonathanscorner.com/admin/ , DirectoryIndex pulls up the same
> index.html (that directory has no index.cgi/index.php/etc.). The message
> logged is:
> 
> [warn] Cannot get media type from 'text.html'

you apparently have misconfigured something, apache thinks the type is
text.html instead of text/html. check configs and .htaccess files.

> Is there any way in httpd.conf or .htaccess that I can get
> DirectoryIndex-served files to be assigned Content-Type "text/html" and not
> "text.html"?

The directory index is mapped to a file and the file is processed as it type
defines. fot .html it should be text/html.
-- 
Matus UHLAR - fantomas, uhlar@fantomas.sk ; http://www.fantomas.sk/
Warning: I wish NOT to receive e-mail advertising to this address.
Varovanie: na tuto adresu chcem NEDOSTAVAT akukolvek reklamnu postu.
10 GOTO 10 : REM (C) Bill Gates 1998, All Rights Reserved!

---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org