Does mod_rewrite add php extension?

For the last 2 days I’ve been trying to run some kind of application on my computer (Ubuntu 11.10, Apache / 2.2.20 (Ubuntu), PHP version 5.3.6-13ubuntu3.1). It was created in PHP Smarty and uses rewriting rules. Everything works fine with links like:

  localhost / news 

it is correctly translated into

  localhost / news.php 

how it should be done. But the problem is related to more complex links like

  localhost / message / inbox 

it must be translated with the rule:

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

But that will not work. I tried to debug it. I switched to write to http.conf

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

And I see that in the beginning 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 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 this is happening?

EDIT: I have a problem to push all rewrite rules onto the stack, here they are: http://pokazkod.pl/d52823d5f0d31ff26e1e29873383d2a2ceb216306a56b3aec1 none of them seem suspicious to me: /

+4
source share
1 answer

Try to remove MultiViews

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

Source: https://habr.com/ru/post/1401843/


All Articles