Home > apache, linux, php, ubuntu > Apache file negotiation error: Negotiation: discovered file(s) matching request: /var/www/mysite/mypage (None could be negotiated).

Apache file negotiation error: Negotiation: discovered file(s) matching request: /var/www/mysite/mypage (None could be negotiated).

I rescued this post from my Drafts, I forgot to post it on time! Here is the original post.

Today I’ve been struggling with an annoying message in Apache’s error log:


[Wed Oct 02 19:18:36 2013] [notice] Apache/2.2.22 (Ubuntu) PHP/5.4.9-4ubuntu2.3 configured -- resuming normal operations
[Wed Oct 02 19:18:43 2013] [error] [client 127.0.0.1] Negotiation: discovered file(s) matching request: /var/www/mysite/view (None could be negotiated).
[Wed Oct 02 19:18:43 2013] [error] [client 127.0.0.1] Negotiation: discovered file(s) matching request: /var/www/mysite/404 (None could be negotiated).

I have two Ubuntu boxes, one with Ubuntu 12.04 LTS 64 bits  and another with Ubuntu 13.04 64 bits recently installed. I usually export projects from one box to another, and when I imported the project to my Ubuntu 13.04 box I got this problem. The website works fine in my 12.04 machine, so, I pressumed it’s an Apache configuration issue between my two boxes.

I want to redirect http://www.mysite.local/home to http://www.mysite.local/view.php?page=home.

My .htaccess works right on the other machine, so I’ve checked for mod_rewrite status and it’s also enabled in the 13.04 box.

This is my VirtualHost :


<Directory /var/www/myotragus.net>
 Options Indexes FollowSymLinks MultiViews
 AllowOverride All
 Order allow,deny
 allow from all
 </Directory>

I adjusted the RewriteLogLevel to 9 but I can’t understand the final redirection from view to -> view:


127.0.0.1 - - [02/Oct/2013:19:00:54 +0200] [www.mysite.local/sid#7f10f7002670][rid#7f10f143c880/initial/redir#3] (2) [perdir /var/www/mysite/] rewrite 'view' -> 'view?page=view'

After googling a while, I tried different things, but none worked:

  • Disabling Multiviews in my VirtualHost did’nt worked
  • Disabling mod_negotiation neither worked for me.

Finally, I found this post at serverfault.com that hit the nail on the head: I have to edit the /etc/apache2/mods-available/mime.conf to add this line:

AddType application/x-httpd-php .php

As Lorenzo said in his answer, the negotiation was failing because mod_negotiation only looks for known file types.

Just restarted apache and all worked again as intended.

Please, leave your comments below.

Advertisements
Categories: apache, linux, php, ubuntu Tags: ,
  1. March 21, 2017 at 16:29

    Saved my day! Perfect solution

    Like

  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: