Asked  4 Months ago    Answers:  5   Viewed   43 times

The client is requesting an image:

GET /api/2.0/users/80.png HTTP/1.1
Proxy-Connection: keep-alive
Accept-Encoding: gzip, deflate
Accept: image/* <------------------------------ HERE'S THE IMPORTANT PART
Accept-Language: en-us
Connection: keep-alive
User-Agent: Echo/ CFNetwork/672.0.2 Darwin/12.5.0

And I have a script at api/2.0/users.php (yes, PATH_INFO is on)

header('Content-Type: image/png');
$user = User::getUserWithID($filename);
header("Location: ".$user->getImageURL());

But Apache or PHP is trying to act like it knows me... and it don't. It assumes a PHP script couldn't possibly want to respond with a image/png and it throws a 406 Not Acceptable error.

Can I successfully configure Apache/PHP to respond to this request?



Can I successfully configure Apache/PHP to respond to this request?

Yes. Just use the MultiviewsMatch directive to tell Apache that it can serve .php files regardless of whether their MIME type is compatible with the Accept header:

<Files "*.php">
    MultiviewsMatch Any

From the docs, the effect is as follows:

You may finally allow Any extensions to match, even if mod_mime doesn't recognize the extension.

Saturday, July 31, 2021
answered 4 Months ago

The order of the defined 'directory index' files also determine their priority.

In your situation, if both an index.html and a index.php are present, Apache will pick the index.html.

To change this, change the order of the 'directory index' files;

DirectoryIndex index.php index.html

Read the documentation here:

Wednesday, March 31, 2021
answered 9 Months ago

My best guess would be that a needed library is missing from your system. The php_ldap extensions requires that both libeay32.dll and ssleay32.dll is installed on the system:

From the ldap installation manual:

Note: Note to Win32 Users

In order for this extension to work, there are DLL files that must be available to the Windows system PATH. For information on how to do this, see the FAQ entitled "How do I add my PHP directory to the PATH on Windows". Although copying DLL files from the PHP folder into the Windows system directory also works (because the system directory is by default in the system's PATH), this is not recommended. This extension requires the following files to be in the PATH: libeay32.dll and ssleay32.dll Versions before PHP 4.3.0 additionally require libsasl.dll.

Saturday, May 29, 2021
answered 7 Months ago

Thanks all of you You all all pointed me in right direction that my imageview is not pointing to my adapter I followed the steps as in and it was working!!! just needed to put my image in hashmap... I was banging my head to the wall!!!

Saturday, August 7, 2021
answered 4 Months ago

First of all you made a mistake of not putting L or PT flag in your first rule. Your code should be like this:

RewriteRule ^hello$ goodbye [PT]

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} !=/favicon.ico
RewriteRule ^ index.php [L]

Once that code is there access this variable in index.php:


This will have value: /goodbye


If you have mod_proxy enabled on your host, you can have your first rule as:

RewriteRule ^hello$ /goodbye [P]

And then you will have: $_SERVER["REQUEST_URI"]=/goodbye

Saturday, August 14, 2021
answered 4 Months ago
Only authorized users can answer the question. Please sign in first, or register a free account.
Not the answer you're looking for? Browse other questions tagged :