4

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 :/

5
  • 1
    please post your rewrite rules Commented Mar 16, 2012 at 15:28
  • When you say it is not working, what do you mean? You get an error? You get the wrong page? The wrong output? I used your rules and when I go to /messages/inbox it calls messages.php?action=inbox just fine. Commented Mar 16, 2012 at 17:14
  • and that's what i would expect with there rules but somehow it calls just messages.php without ?action=inbox. In messages.php there is switch statment on $_GET['action'] and i can see that variable $_GET is empty... I think it's a problem with configuration of Apache but i can't find where the hell is it. Commented Mar 17, 2012 at 10:42
  • Probably a typo, but in your url you use message, and in you rewriterule messages (plural). Also adding RewriteEngine On could help. Commented Mar 17, 2012 at 12:05
  • yes, it's just typo and ReWriteEngine On is already added in the begining .htaccess ... Commented Mar 19, 2012 at 7:27

1 Answer 1

8

Try removing MultiViews

<Directory /var/www/engbook>
    Options Indexes FollowSymLinks
    AllowOverride All
    Order allow,deny
    allow from all
</Directory>
Sign up to request clarification or add additional context in comments.

2 Comments

OP hasn't accepted this, but I've just had the same problem and removing MultiViews solved it, so cheers for the post.
Thanks @afanasy. It helped me to find out my rewrite rule problem

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.