Forum Moderators: phranque
RewriteCond %{REQUEST_URI} ^\/widgets\/([0-9]{4})\/([0-9]+)$
RewriteRule .* /widgets.php?year=%1&id=%2 [L]
It rewrites
/widgets/2004/23
into
/widgets.php?year=2004&id=23
Works fine, except for Googlebot: Apache returns an error 406 ("Not Acceptable"). At first I thought it might have something to do with Googlebot using HTTP/1.0, but normal browsers using that protocol get the 200 content.
Does anyone know what could be the cause?
This is probably a MIME-type problem, and whatever MIME-type your server provides for your php file output is not acceptable to Google. Use the server headers checker [webmasterworld.com] to see what your server returns for requests. Google can handle text/html and the Word and PDF foramts, and maybe others, too.
Jim
I've done some more research on the error message "no acceptable variant" as related to MIME-types. My guess now is that the URL /widget/2003/24 , with no extension, might cause some confusion. So I've changed all the links into /widget/2003/24.html and modified the rewrite stuff accordingly. Now I'll just have to wait for the bot to come by again...
i had this problem with some php scripts as well. i tracked it down to the force-type directive which i used in my .htaccess
it occured when accessing a virtual subfolder path. e.g.
photos/12/2003
and using in my .htaccess
<Files photos>
ForceType application/x-httpd-php
</Files>
i stopped using that and changed everything over to addhandler and the headers were correct again - even without the .htm extension
i am not sure of the technical reason why it happened, but this might help you track it down
good luck
Adding the .html extension didn't help either. I found some reports about the error message 'no acceptable content' being related to problems with mod_negotiation, so I started fiddling with that. This morning I switched off the MultiViews option, and now Googlebot gets the lovely 200 code again!
I'm definitely no Apache expert, so I won't draw any conclusions on what caused all this. I'm just happy it all works again :)
Googlebot could get 200 code just last week, but these days it got 302 error.
I used the Server Header Check and it get 200 ok,
I'm thinking maybe Googlebot just want to retrieve the file of 'abc.html' and reject to negotiate with the apache server.
I'm still no idea how to figure it out.
Anybody can help me out?
Thanks.
I think it is because Googlebot just be modified and doesn't follow HTTP1.0 rules, and doesn't work on mod_negotiation.
Your chances of getting a reply depend on how good a job you do explaining the problem, how well you document it (include a few lines from your log file, with and without MultiViews enabled), and whether what you submit reads like a professional "problem report" or just a complaint or a rant. A report that is "short, sweet, and to the point," but "well-documented enough to understand the problem" will be ideal.
I'm sure Google would at least be interested in hearing about technical problems.
Best,
Jim
Don't use this solution:
-------------
Options +MultiViews
<FilesMatch "^widgets$">
ForceType application/x-httpd-php
</FilesMatch>
-------------
In this solution, googlebot will get 200 code the first time it crawled, but the second time, it will get 406 from the server, it is not the googlebot bugs, it is just a behavior of the new googlebot.
Now I used the mod_rewrite solution, it works fine:
------------
Options -MultiViews
RewriteEngine on
RewriteBase /
RewriteRule ^(.*)/(.*) /wedgets.php?v1=$1&v2=$2 [L]
------------
Make sure use 'Options -MultiViews' to turn off the MultiViews, this will disable the apache server content-negotiation feature, and googlebot has no way to get more information beyond the 200 return.
Googlebot is very tricky.