Apache mod rewrite leads to 404

Bug #978301 reported by phililippe on 2012-04-10
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
apache2 (Ubuntu)
Low
Unassigned

Bug Description

Today, I installed a brand new server with 11.10 and duplicated a working architecture on it (live on 2 other servers). This is not working due to rewrite issues.

From this .htaccess (mytwatch VHost):

(...)

<IfModule mod_rewrite.c>
        RewriteEngine On

        # Protect application and system files from being viewed
        RewriteRule ^(?:application|modules|system)\b - [F,L]
        # Allow any files or directories that exist to be displayed directly
        RewriteCond %{REQUEST_FILENAME} !-f
        RewriteCond %{REQUEST_FILENAME} !-d
        RewriteCond %{REQUEST_URI} !/.*\.(png|jpg|gif|css|js)$
        # Rewrite all other URLs to index.php/URL
        RewriteRule .* index.php/$0 [PT] # Original config. Also tried with [L] instead
</IfModule>

Calling : /welcome gets 404 on /index.php/welcome does not exists.
In this case index.php is a script containing routing functions dans there's no such file as index.php/welcome in document root.

RewriteLog (level 3) gives :
88.162.200.2 - philippe [10/Apr/2012:21:34:17 +0200] [miner2.mytnet.net/sid#7f144e5fdc60][rid#7f144e46c0a0/initial] (3) [perdir /data/www/mytwatch/htdocs/] strip per-dir prefix: /data/www/mytwatch/htdocs/welcome -> welcome
88.162.200.2 - philippe [10/Apr/2012:21:34:17 +0200] [miner2.mytnet.net/sid#7f144e5fdc60][rid#7f144e46c0a0/initial] (3) [perdir /data/www/mytwatch/htdocs/] applying pattern '^(?:application|modules|system)\b' to uri 'welcome'
88.162.200.2 - philippe [10/Apr/2012:21:34:17 +0200] [miner2.mytnet.net/sid#7f144e5fdc60][rid#7f144e46c0a0/initial] (3) [perdir /data/www/mytwatch/htdocs/] strip per-dir prefix: /data/www/mytwatch/htdocs/welcome -> welcome
88.162.200.2 - philippe [10/Apr/2012:21:34:17 +0200] [miner2.mytnet.net/sid#7f144e5fdc60][rid#7f144e46c0a0/initial] (3) [perdir /data/www/mytwatch/htdocs/] applying pattern '.*' to uri 'welcome'
88.162.200.2 - philippe [10/Apr/2012:21:34:17 +0200] [miner2.mytnet.net/sid#7f144e5fdc60][rid#7f144e46c0a0/initial] (2) [perdir /data/www/mytwatch/htdocs/] rewrite 'welcome' -> 'index.php/welcome'
88.162.200.2 - philippe [10/Apr/2012:21:34:17 +0200] [miner2.mytnet.net/sid#7f144e5fdc60][rid#7f144e46c0a0/initial] (3) [perdir /data/www/mytwatch/htdocs/] add per-dir prefix: index.php/welcome -> /data/www/mytwatch/htdocs/index.php/welcome
88.162.200.2 - philippe [10/Apr/2012:21:34:17 +0200] [miner2.mytnet.net/sid#7f144e5fdc60][rid#7f144e46c0a0/initial] (2) [perdir /data/www/mytwatch/htdocs/] forcing '/data/www/mytwatch/htdocs/index.php/welcome' to get passed through to next API URI-to-filename handler
88.162.200.2 - philippe [10/Apr/2012:21:34:17 +0200] [miner2.mytnet.net/sid#7f144e5fdc60][rid#7f144e46c0a0/initial] (2) [perdir /data/www/mytwatch/htdocs/] strip document_root prefix: /data/www/mytwatch/htdocs/index.php/welcome -> /index.php/welcome
88.162.200.2 - philippe [10/Apr/2012:21:34:17 +0200] [miner2.mytnet.net/sid#7f144e5fdc60][rid#7f144e46c0a0/initial] (1) [perdir /data/www/mytwatch/htdocs/] internal redirect with /index.php/welcome [INTERNAL REDIRECT]
88.162.200.2 - philippe [10/Apr/2012:21:34:17 +0200] [miner2.mytnet.net/sid#7f144e5fdc60][rid#7f144e45c540/initial/redir#1] (3) [perdir /data/www/mytwatch/htdocs/] add path info postfix: /data/www/mytwatch/htdocs/index.php -> /data/www/mytwatch/htdocs/index.php/welcome
88.162.200.2 - philippe [10/Apr/2012:21:34:17 +0200] [miner2.mytnet.net/sid#7f144e5fdc60][rid#7f144e45c540/initial/redir#1] (3) [perdir /data/www/mytwatch/htdocs/] strip per-dir prefix: /data/www/mytwatch/htdocs/index.php/welcome -> index.php/welcome
88.162.200.2 - philippe [10/Apr/2012:21:34:17 +0200] [miner2.mytnet.net/sid#7f144e5fdc60][rid#7f144e45c540/initial/redir#1] (3) [perdir /data/www/mytwatch/htdocs/] applying pattern '^(?:application|modules|system)\b' to uri 'index.php/welcome'
88.162.200.2 - philippe [10/Apr/2012:21:34:17 +0200] [miner2.mytnet.net/sid#7f144e5fdc60][rid#7f144e45c540/initial/redir#1] (3) [perdir /data/www/mytwatch/htdocs/] add path info postfix: /data/www/mytwatch/htdocs/index.php -> /data/www/mytwatch/htdocs/index.php/welcome
88.162.200.2 - philippe [10/Apr/2012:21:34:17 +0200] [miner2.mytnet.net/sid#7f144e5fdc60][rid#7f144e45c540/initial/redir#1] (3) [perdir /data/www/mytwatch/htdocs/] strip per-dir prefix: /data/www/mytwatch/htdocs/index.php/welcome -> index.php/welcome
88.162.200.2 - philippe [10/Apr/2012:21:34:17 +0200] [miner2.mytnet.net/sid#7f144e5fdc60][rid#7f144e45c540/initial/redir#1] (3) [perdir /data/www/mytwatch/htdocs/] applying pattern '.*' to uri 'index.php/welcome'
88.162.200.2 - philippe [10/Apr/2012:21:34:17 +0200] [miner2.mytnet.net/sid#7f144e5fdc60][rid#7f144e45c540/initial/redir#1] (1) [perdir /data/www/mytwatch/htdocs/] pass through /data/www/mytwatch/htdocs/index.php

ProblemType: Bug
DistroRelease: Ubuntu 11.10
Package: apache2 (not installed)
Uname: Linux 2.6.38.2-grsec-xxxx-grs-ipv6-64 x86_64
Apache2ConfdDirListing: ['other-vhosts-access-log', 'charset', 'localized-error-pages', 'security']
ApportVersion: 1.23-0ubuntu4
Architecture: amd64
Date: Tue Apr 10 21:24:35 2012
ProcEnviron:
 SHELL=/bin/bash
 PATH=(custom, no user)
 LANG=fr_FR.UTF-8
SourcePackage: apache2
UpgradeStatus: No upgrade log present (probably fresh install)
modified.conffile..etc.apache2.ports.conf: [modified]
mtime.conffile..etc.apache2.ports.conf: 2012-04-02T21:10:28

phililippe (philippe-ub) wrote :
phililippe (philippe-ub) wrote :

NB 1 : Seems not to be related to mod rewrite as, if I disable it, I still get error 404 on /index.php/welcome with error log : File does not exist: /data/www/mytwatch/htdocs/index.php/welcome
NB 2 : After that, I also incrementally changed my /etc/apache2/mod-enabled/php5filter.conf to :
<IfModule mod_php5.c>
 AddType application/x-httpd-php .php
 AddHandler application/x-httpd-php .php
    <FilesMatch "\.ph(p3?|tml)$">
 SetHandler application/x-httpd-php
 SetInputFilter PHP
 SetOutputFilter PHP
    </FilesMatch>
</IfModule>
Same issue, same results... no more ideas.

James Page (james-page) on 2012-04-12
Changed in apache2 (Ubuntu):
importance: Undecided → Low
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers