Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

mod_rewrite adding php extension?

Last 2 days i'm trying to run some application on my computer (Ubuntu 11.10, Apache/2.2.20 (Ubuntu), PHP Version 5.3.6-13ubuntu3.1). It's created in PHP Smarty and it use rewrite rules. Everything works fine with links like:

localhost/news

it's correctly translated into

localhost/news.php 

how it should be done. But the problem is with more complicated links like

localhost/message/inbox

it should be translated with rule:

RewriteRule ^messages/(.*)$ /messages.php?action=$1

But it doesn't work. I was trying to debug it. I've truned on logging in http.conf

RewriteLog "/home/krzysztofp/rewrite.log"
RewriteLogLevel 3

And what i can see is that in the begining there is

127.0.0.1 - - [16/Mar/2012:15:56:36 +0100] [krzysztofp/sid#7f8218546a30][rid#7f821837a0a0/subreq] (3) [perdir /var/www/engbook/] add path info postfix: /var/www/engbook/messages.php -> /var/www/engbook/messages.php/inbox

and then it's trying to match message.php

127.0.0.1 - - [16/Mar/2012:15:56:36 +0100] [krzysztofp/sid#7f8218546a30][rid#7f821837a0a0/subreq] (3) [perdir /var/www/engbook/] applying pattern '^messages/(.*)$' to uri 'messages.php/inbox'

Virtual Host:

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

any idea why it's happening?

EDIT: i have a problem to put all rewrite rules on stack so here they are: http://pokazkod.pl/d52823d5f0d31ff26e1e29873383d2a2ceb216306a56b3aec1 none on them look suspicious to me :/

like image 819
krzysiek Avatar asked Feb 21 '23 03:02

krzysiek


1 Answers

Try removing MultiViews

<Directory /var/www/engbook>
    Options Indexes FollowSymLinks
    AllowOverride All
    Order allow,deny
    allow from all
</Directory>
like image 137
Afanasii Kurakin Avatar answered Feb 27 '23 02:02

Afanasii Kurakin