Question

I've just installed a new instance on AWS with Apache 2 and PHP 5.4. Everything is working except timthumb.php. The error I see is:

Negotiation: discovered file(s) matching request: /var/www/photos/thumb (None could be negotiated).

My .htaccess file in /photos looks like this:

RewriteEngine on
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^thumb/(.*)$ /photos/thumb.php?src=http://cdn.my-host.com/$1 [L]

After doing some research it looked like I needed to add the PHP type so I did this in my mime.conf file:

AddType application/x-httpd-php .php

After restarting apache I now see this error:

PHP Fatal error:  Unknown: Failed opening required '/var/www/photos/thumb.php'

Am I heading down the wrong path? I'm trying to resolve the first error but I think I'm headed in the wrong direction. Any thoughts what is wrong?

Was it helpful?

Solution

You need to turn off mod_negotiation

At the top of your htaccess file, add:

Options -MultiViews

Mod_negotiation sees a request like /photos/thumb/something, and when it tries to map that URI to a file, it sees the file at /photos/thumb.php, and thinks that the request was for that file (which it is). The problem is that this will completely bypass mod_rewrite, so your rules don't get applied.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top