You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by Matt <ma...@spam.matt.blissett.me.uk> on 2004/08/15 23:48:58 UTC

[users@httpd] Multiviews + PHP --> 406 for MSNbot, Googlebot. Content-type for .php files not appropriate to their content.

Hi

I'm using Multiviews with my URLs. Most of the files are PHP scripts  
returning text/html, though not all. The Content-Type header is set within  
the PHP using this:
  header("Content-Type: text/html; charset=utf-8");

MSNbot and GoogleBot receive 406 responses: for the URL  
http://matt.blissett.me.uk/contact for example, from a log (with the  
Accept header shown):
"GET /contact HTTP/1.0" "text/html" 406 "msnbot/0.11  
(+http://search.msn.com/msnbot.htm)"
"GET /contact HTTP/1.0" "text/html,text/plain" 406 "Googlebot/2.1  
(+http://www.google.com/bot.html)"

This is apparently the problem:

HEAD /contact HTTP/1.1
Host: matt.blissett.me.uk
Accept: text/html

HTTP/1.1 406 Not Acceptable
Date: Sun, 15 Aug 2004 21:33:06 GMT
Server: Apache/2.0.50 (Unix) PHP/4.3.8-dev
Alternates: {"contact.php" 1 {type application/x-httpd-php} {length 1388}}
Vary: negotiate
TCN: list
Content-Type: text/html; charset=iso-8859-1

Apache sees the contact.php file and 'knows' it is  
application/x-httpd-php. But in fact it returns (in this case) text/html.  
How do I tell Apache this?

Here's a few lines from the config file:

<Directory /home/*/public_html>
     AllowOverride None
     Options MultiViews Indexes SymLinksIfOwnerMatch Includes
</Directory>

DirectoryIndex index.html index.php index.html.var index.cgi index

TypesConfig conf/mime.types

DefaultType application/octet-stream

<IfModule mod_mime_magic.c>
     MIMEMagicFile conf/magic
</IfModule>

There are a couple of other problems, but these are most likely directly  
related anyway.

Thanks everyone :)

-- 
Matt
http://matt.blissett.me.uk/

---------------------------------------------------------------------
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] Multiviews + PHP --> 406 for MSNbot, Googlebot. Content-type for .php files not appropriate to their content.

Posted by Joshua Slive <js...@gmail.com>.
On Sun, 15 Aug 2004 22:48:58 +0100, Matt
<ma...@spam.matt.blissett.me.uk> wrote:

> Apache sees the contact.php file and 'knows' it is
> application/x-httpd-php. But in fact it returns (in this case) text/html.
> How do I tell Apache this?

Don't use AddType when what you really want is to activate a handler.

See:
http://tranchant.plus.com/notes/multiviews

Joshua.

---------------------------------------------------------------------
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