Apache: Negotiation: Discovered File(s) Matching Request: None Could Be Negotiated

December 22, 2015 by Linux Guru

Filed under Application, Linux, logs, php

Last modified June 15, 2016

Apache: Negotiation: Discovered File(s) Matching Request: None Could Be Negotiated

There are some methods to provide file in this manner,

 www.example.com/index.php => www.example.com/index

1. Use of MultiViews
In virtual host list, you can add entry for your server files by creating an alias.

 <Directory “/home/server/htdocs”>
Options Indexes Includes FollowSymLinks MultiViews
Order allow,deny
Allow from all
AllowOverride All
</Directory>

2. Use of RewriteEngine
Make sure to enable mod_rewrite;
Creating a .htaccess file for rewriting url and add following content into it,

 RewriteEngine On
RewriteRule ^([^.]+)$ $1.php

Problem & Solution: Considering all working in PHP, and mod_negotiation enabled. I got this message on the server apache error_log

 Negotiation: discovered file(s) matching request: /home/server/htdocs/index (None could be negotiated)

So as to resolve this issue, we need to add extra type definition for PHP in apache config.

 AddType application/x-httpd-php .php

Leave a Comment